[Bug 63445] “Too many open files” after migrating from Tomcat 7 to Tomcat 9

2019-05-17 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63445

Gerald Spitzer  changed:

   What|Removed |Added

 Resolution|INVALID |---
 Status|RESOLVED|REOPENED

--- Comment #2 from Gerald Spitzer  ---
But it is exactly the same application, the ONLY difference is the Tomcat
version - so it must be something Tomcat related.

Increasing the fd limit is not an option for our customer which hosts the
application.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 7.0.x updated: Fix patch porting

2019-05-17 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
 new ac66f05  Fix patch porting
ac66f05 is described below

commit ac66f059421813500cad645631b8a13149179453
Author: remm 
AuthorDate: Fri May 17 10:45:53 2019 +0200

Fix patch porting
---
 java/org/apache/catalina/ha/session/DeltaSession.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/java/org/apache/catalina/ha/session/DeltaSession.java 
b/java/org/apache/catalina/ha/session/DeltaSession.java
index 972a33e..151b1d6 100644
--- a/java/org/apache/catalina/ha/session/DeltaSession.java
+++ b/java/org/apache/catalina/ha/session/DeltaSession.java
@@ -606,6 +606,7 @@ public class DeltaSession extends StandardSession 
implements Externalizable,Clus
 }
 
 public void resetDeltaRequest() {
+lock();
 try {
 deltaRequest.reset();
 deltaRequest.setSessionId(getIdInternal());


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 63445] “Too many open files” after migrating from Tomcat 7 to Tomcat 9

2019-05-17 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63445

Mark Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID

--- Comment #1 from Mark Thomas  ---
Only a descriptor leak would be considered a bug. There is no evidence of such
a leak in this report.

That there are multiple  descriptors for the same file is unexpected. It maybe
the result of how JSF2 is accessing those resources. It appears you need to
increase the fd limit.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 63445] New: “Too many open files” after migrating from Tomcat 7 to Tomcat 9

2019-05-17 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63445

Bug ID: 63445
   Summary: “Too many open files” after migrating from Tomcat 7 to
Tomcat 9
   Product: Tomcat 9
   Version: 9.0.20
  Hardware: PC
OS: Linux
Status: NEW
  Severity: critical
  Priority: P2
 Component: Catalina
  Assignee: dev@tomcat.apache.org
  Reporter: gerald.spit...@fab4minds.com
  Target Milestone: -

After migrating from Tomact 7 to Tomcat 9.0.20 (running with same Java Version
1.8.0_25) we have a problem with our JSF2 web application on Linux RHEL 7.
After some time we get Exceptions like this:

java.io.FileNotFoundException:
/f4m/tomcat/tomcat_f4mbs/webapps/ACM/WEB-INF/acm-config.xml (Too many open
files)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.(FileInputStream.java:138)
at java.io.FileInputStream.(FileInputStream.java:93)


After searching around a while, I have found out that there are many open file
descriptors to xhtml files, by executing this command (where 4025 is the Tomcat
process ID):

ls -l /proc/4025/fd


lr-x--. 1 f4mHttp f4mHttp 64 May 16 08:58 238 ->
/usr/java/jdk1.8.0_25/jre/lib/resources.jar
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:01 239 -> pipe:[3661823]
lr-x--. 1 f4mHttp f4mHttp 64 May 16 08:58 24 ->
/f4m/tomcat/tomcat_f4mbscrm/lib/websocket-api.jar
l-wx--. 1 f4mHttp f4mHttp 64 May 16 09:01 240 -> pipe:[3661823]
lrwx--. 1 f4mHttp f4mHttp 64 May 16 09:01 241 -> anon_inode:[eventpoll]
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:01 243 -> pipe:[3661824]
l-wx--. 1 f4mHttp f4mHttp 64 May 16 09:01 244 -> pipe:[3661824]
lrwx--. 1 f4mHttp f4mHttp 64 May 16 09:01 245 -> anon_inode:[eventpoll]
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:01 246 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/msgBox.xhtml
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:01 247 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/msgBox.xhtml
lrwx--. 1 f4mHttp f4mHttp 64 May 16 09:01 248 -> socket:[3667364]
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:02 249 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/searchpage.xhtml
lr-x--. 1 f4mHttp f4mHttp 64 May 16 08:58 25 ->
/f4m/tomcat/tomcat_f4mbscrm/lib/jasper.jar
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:01 250 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/searchpage.xhtml
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:01 251 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/portal/nav/portalheader.xhtml
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:02 252 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/portal/customizing/nav/menu.xhtml
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:01 253 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:01 254 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/nav/bottomPanel.xhtml
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:01 255 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/nav/bottomPanel.xhtml
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:01 256 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/msgBox.xhtml
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:01 257 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:02 258 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:02 259 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml
lr-x--. 1 f4mHttp f4mHttp 64 May 16 08:58 26 ->
/f4m/tomcat/tomcat_f4mbscrm/lib/ecj-4.9.jar
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:02 260 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:02 261 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:02 262 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/common/barcodefunction_incl.xhtml
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:02 263 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/portal/nav/portalfooterAll.xhtml
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:02 264 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/partner/crmpartner.xhtml
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:02 266 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/partner/crmpartner.xhtml
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:02 267 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/portal/nav/portalheader.xhtml
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:02 268 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/portal/customizing/nav/menu.xhtml
lr-x--. 1 f4mHttp f4mHttp 64 May 16 08:58 27 ->
/f4m/tomcat/tomcat_f4mbscrm/lib/catalina-ha.jar
lr-x--. 1 f4mHttp f4mHttp 64 May 16 09:02 274 ->

Re: [tomcat] branch 7.0.x updated: Fix patch porting

2019-05-17 Thread Mark Thomas
On 17/05/2019 09:46, r...@apache.org wrote:
> This is an automated email from the ASF dual-hosted git repository.
> 
> remm pushed a commit to branch 7.0.x
> in repository https://gitbox.apache.org/repos/asf/tomcat.git
> 
> 
> The following commit(s) were added to refs/heads/7.0.x by this push:
>  new ac66f05  Fix patch porting
> ac66f05 is described below
> 
> commit ac66f059421813500cad645631b8a13149179453
> Author: remm 
> AuthorDate: Fri May 17 10:45:53 2019 +0200
> 
> Fix patch porting

Thanks

Mark

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Wiki migration

2019-05-17 Thread Mark Thomas
On 26/03/2019 17:52, Mark Thomas wrote:
> On 25/03/2019 22:24, Konstantin Kolinko wrote:
>> пт, 15 мар. 2019 г. в 21:32, Mark Thomas :
>>> On 15/03/2019 18:05, Konstantin Kolinko wrote:

 As currently, it is not configured to echo changes to the dev@ mailing 
 list,
 and if done so it cannot send plaintext e-mails.
>>>
>>> That issue is 50% confluence (it marks the changes email as bulk with no
>>> option to change that) and 50% ezmlm (it automatically drops bulk
>>> email). That problem should be solvable. I'll pester infra about that one.
>>
>> Any progress here?
> 
> I asked on slack but I think the question got overlooked. I've raised:
> https://issues.apache.org/jira/browse/INFRA-18107

As you have probably noticed, this has been fixed - mostly thanks to sebb.

Mark

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch master updated: Disable APR async again

2019-05-17 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 3a8e4eb  Disable APR async again
3a8e4eb is described below

commit 3a8e4ebc948b3e8fcef4e44571ae5238beac835b
Author: remm 
AuthorDate: Fri May 17 15:42:14 2019 +0200

Disable APR async again
---
 java/org/apache/tomcat/util/net/AprEndpoint.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java 
b/java/org/apache/tomcat/util/net/AprEndpoint.java
index 9767111..c577257 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -120,9 +120,9 @@ public class AprEndpoint extends 
AbstractEndpoint implements SNICallB
 setMaxConnections(8 * 1024);
 // Asynchronous IO has significantly lower performance with APR:
 // - no IO vectoring
-// - mandatory use of direct buffers causing required output buffering
-// - needs extra output flushes due to the buffering
-//setUseAsyncIO(false);
+// - mandatory use of direct buffers forces output buffering
+// - needs extra output flushes due to buffering
+setUseAsyncIO(false);
 }
 
 // - Properties


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: [tomcat] branch master updated: Reduce the default HTTP/2 header list size from 4GB to 32kB

2019-05-17 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Mark,

On 5/16/19 16:39, ma...@apache.org wrote:
> This is an automated email from the ASF dual-hosted git
> repository.
> 
> markt pushed a commit to branch master in repository
> https://gitbox.apache.org/repos/asf/tomcat.git
> 
> 
> The following commit(s) were added to refs/heads/master by this
> push: new c44cf6c  Reduce the default HTTP/2 header list size from
> 4GB to 32kB



- -chris

> c44cf6c is described below
> 
> commit c44cf6cd2d2b06dc566d802ab9187d80a68fa5f0 Author: Mark Thomas
>  AuthorDate: Thu May 16 21:38:45 2019 +0100
> 
> Reduce the default HTTP/2 header list size from 4GB to 32kB
> 
> Aligns Tomcat with typical HTTP/2 implementations. --- 
> java/org/apache/coyote/http2/ConnectionSettingsBase.java | 2 +- 
> webapps/docs/changelog.xml   | 4  2
> files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git
> a/java/org/apache/coyote/http2/ConnectionSettingsBase.java
> b/java/org/apache/coyote/http2/ConnectionSettingsBase.java index
> 939e6d0..3cf2d8d 100644 ---
> a/java/org/apache/coyote/http2/ConnectionSettingsBase.java +++
> b/java/org/apache/coyote/http2/ConnectionSettingsBase.java @@ -43,7
> +43,7 @@ abstract class ConnectionSettingsBase
> { static final long DEFAULT_MAX_CONCURRENT_STREAMS = UNLIMITED; 
> static final int DEFAULT_INITIAL_WINDOW_SIZE = (1 << 16) - 1; 
> static final int DEFAULT_MAX_FRAME_SIZE = MIN_MAX_FRAME_SIZE; -
> static final long DEFAULT_MAX_HEADER_LIST_SIZE = UNLIMITED; +
> static final long DEFAULT_MAX_HEADER_LIST_SIZE = 1 << 15;
> 
> Map current = new EnumMap<>(Setting.class); 
> Map pending = new EnumMap<>(Setting.class); diff
> --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml 
> index c1e6b03..2aeb8c8 100644 --- a/webapps/docs/changelog.xml +++
> b/webapps/docs/changelog.xml @@ -132,6 +132,10 @@ 
> Http2Protocol from 200 to 100 to align with typical 
> defaults for HTTP/2 implementations. (markt)  +
>  +Reduce the default HTTP/2 header list size from
> 4GB to 32kB to align +with typical HTTP/2 implementations.
> (markt) +  name="Cluster">
> 
> 
> -
>
> 
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
> 
-BEGIN PGP SIGNATURE-
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlzeyBsACgkQHPApP6U8
pFhd9A//cQx1EeKy8CMMClXWS5THmcNLAuAwPhpX4FACq+e9iX+Z8OFLXYTeGhv2
XP85v9zJBvSK/eAo6H1QWkOTZqqt4wYt5Nnt4ivjnJ3Vjr898EbfnP8Fv7xCSwxY
aXM+1bt/jGC6Qa4r5xw9o518hiw1rssqMN4ifyxh0o5oEyklE4eHHGbg8y+xFUCp
TsCIQ2KzxETc9ErywzXO4xao+nd9sVLChCVkTdELBMzZoXMrDB0cEZbK50Gcs14o
mhaDGjSFqUN8W8qcPLryFLHOQoMQm3agRRTgsc5ScuBlmS/B0G7ndMyGf6OaIlLh
GiZbD/CJFwH1VzS8zTSQM3iGSRu+yYckRlThDOQjTbCunc9Qu+7S9OQQCW4DxfaN
QhGWlpixJO2E7GUfKJCNY4ItkWuaVhTjPkdpNnqHo0PMkDrwUGZPibLK90HgbX2e
3kQGEr8q8Gv+qdTiHvCEaSQH0CEVF5YnGRk1RKSbtSgufAWkwhOas24jkc9wVC83
2dGlUEzBEU9kcF/v4DobJnKZPhkRBlQpCmpxCSa+LI7izaRQan5EIb4tNchRDRi2
awlJVnZMJ3XfB6w/4kpONd/B7qOBduVmzfdRMdhd0KgrHltn7tJY9sfinPyQMfQY
ilrPl+5BYa3f67PsTahiB8xghWUQ/su/nBo1gzqbw9nILET61oQ=
=/l5K
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[CONF] Apache Tomcat > WebSocket TCK

2019-05-17 Thread Mark Thomas (Confluence)
Title: Message Title



 
 
 
There's 1 new edit on this page 
 
 
 
 
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
WebSocket TCK 
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
Mark Thomas edited this page 
 
 
  
 
 

 
 
 
  
 
 
  
 
 
  
 
 
 
 
 
 
 
 
 
 
Here's the version comment 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
 
  
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
Mark Thomas edited at 12:46 PM 
 
 
  
 
 

 
 
 
 
 
 
 
 
 Add note to reduce ws_wait  
 
 
  
 
 
  
 
 

 
 
 
  
 
 
  
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Here's what changed: 
 
 
 
 
 
 
 
 
 
 
 ... websocket.classes=/home/mark/repos/asf-public/tomcat/trunk/output/build/lib/tomcat-websocket.jar:/home/mark/repos/asf-public/tomcat/trunk/output/build/lib/servlet-api.jar:/home/mark/repos/asf-public/tomcat/trunk/output/build/lib/tomcat-util.jar:/home/mark/repos/asf-public/tomcat/trunk/output/build/lib/tomcat-api.jar:/home/mark/repos/asf-public/tomcat/trunk/output/build/bin/tomcat-juli.jar The WebSocket tests use a lot of pauses. The default pause time is 5s which means the elapsed time for the WebSocket tests is very high. It is recommended you set this to the minimum (1s) unless something in your environment means a longer wait is required.   ws_wait=1 
set JAVA_HOME Run ant gui Accept the defaults and then run the tests ...  
 
 
  
 
 
  
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Go to page history 
 
 
  
 
 
  
 
 
  
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
View page 
 
 
  
 
 
  
 
 
  
 
 
  
 
 
 
 
 
 
 
 
 
 
Stop watching space
• 
 
 
 
 
 
 
Manage notifications 
 
 
 
 
 
 
 
 
 
 
  
 
 
This message was sent by Atlassian Confluence 6.15.2  
 
 
  
 
 
 
 
 
 
 
 
 




[tomcat] branch master updated: Attempt to fix APR flush

2019-05-17 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 32d8242  Attempt to fix APR flush
32d8242 is described below

commit 32d82429b158d29ea1176fd1b4cb0b548cb9b78c
Author: remm 
AuthorDate: Fri May 17 14:46:01 2019 +0200

Attempt to fix APR flush

Fix NPE I saw in maintain. Do a CI run to see the results (will still be
disabled afterwards since the performance is obviously worse).
---
 java/org/apache/tomcat/util/net/AprEndpoint.java | 44 ++--
 java/org/apache/tomcat/util/net/NioEndpoint.java |  2 +-
 2 files changed, 20 insertions(+), 26 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java 
b/java/org/apache/tomcat/util/net/AprEndpoint.java
index a8437cb..9767111 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -122,7 +122,7 @@ public class AprEndpoint extends 
AbstractEndpoint implements SNICallB
 // - no IO vectoring
 // - mandatory use of direct buffers causing required output buffering
 // - needs extra output flushes due to the buffering
-setUseAsyncIO(false);
+//setUseAsyncIO(false);
 }
 
 // - Properties
@@ -1319,15 +1319,17 @@ public class AprEndpoint extends 
AbstractEndpoint implements SNICallB
 Long.valueOf(socket)));
 }
 AprSocketWrapper socketWrapper = 
connections.get(Long.valueOf(socket));
-socketWrapper.setError(new SocketTimeoutException());
-if (socketWrapper.readOperation != null || 
socketWrapper.writeOperation != null) {
-if (socketWrapper.readOperation != null) {
-socketWrapper.readOperation.process();
+if (socketWrapper != null) {
+socketWrapper.setError(new SocketTimeoutException());
+if (socketWrapper.readOperation != null || 
socketWrapper.writeOperation != null) {
+if (socketWrapper.readOperation != null) {
+socketWrapper.readOperation.process();
+} else {
+socketWrapper.writeOperation.process();
+}
 } else {
-socketWrapper.writeOperation.process();
+processSocket(socketWrapper, SocketEvent.ERROR, true);
 }
-} else {
-processSocket(socketWrapper, SocketEvent.ERROR, true);
 }
 socket = timeouts.check(date);
 }
@@ -2790,11 +2792,6 @@ public class AprEndpoint extends 
AbstractEndpoint implements SNICallB
 }
 return;
 }
-if (!read && flush(false)) {
-inline = false;
-registerWriteInterest();
-return;
-}
 // Find the buffer on which the operation will be 
performed (no vectoring with APR)
 ByteBuffer buffer = null;
 for (int i = 0; i < length; i++) {
@@ -2803,23 +2800,20 @@ public class AprEndpoint extends 
AbstractEndpoint implements SNICallB
 break;
 }
 }
-if (buffer == null ) {
+if (buffer == null) {
 // Nothing to do
 return;
 }
 if (read) {
 nBytes = read(false, buffer);
 } else {
-int remaining = buffer.remaining();
-writeNonBlockingDirect(buffer);
-nBytes = remaining - buffer.remaining();
-if (nBytes > 0) {
-try {
-if (flush(false)) {
-registerWriteInterest();
-}
-} catch (IOException e) {
-// Ignore, will be delayed to later
+if (!flush(false)) {
+int remaining = buffer.remaining();
+writeNonBlockingDirect(buffer);
+nBytes = 

[SECURITY] CVE-2019-0221 Apache Tomcat XSS in SSI printenv

2019-05-17 Thread Mark Thomas
CVE-2019-0221 Apache Tomcat XSS in SSI printenv

Severity: Low

Vendor: The Apache Software Foundation

Versions Affected:
Apache Tomcat 9.0.0.M1 to 9.0.17
Apache Tomcat 8.5.0 to 8.5.39
Apache Tomcat 7.0.0 to 7.0.93

Description:
The SSI printenv command echoes user provided data without escaping and
is, therefore, vulnerable to XSS. SSI is disabled by default. The
printenv command is intended for debugging and is unlikely to be present
in a production website.

Mitigation:
Users of affected versions should apply one of the following mitigations:
- Disable SSI
- Upgrade to Apache Tomcat 9.0.18 or later
- Upgrade to Apache Tomcat 8.5.40 or later
- Upgrade to Apache Tomcat 7.0.94 or later

Credit:
This issue was identified by Nightwatch Cybersecurity Research and
reported to the Apache Tomcat security team via the bug bounty program
sponsored by the EU FOSSA-2 project.

References:
[1] http://tomcat.apache.org/security-9.html
[2] http://tomcat.apache.org/security-8.html
[3] http://tomcat.apache.org/security-7.html

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch master updated: Add sync back after #4366

2019-05-17 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new c946142  Add sync back after #4366
c946142 is described below

commit c946142b886e1c103fd1ad992f5cb9c6604b99f1
Author: remm 
AuthorDate: Fri May 17 13:07:59 2019 +0200

Add sync back after #4366
---
 java/org/apache/tomcat/util/net/Nio2Endpoint.java | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java 
b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
index b1a038d..e1ab5d0 100644
--- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java
+++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
@@ -1016,9 +1016,11 @@ public class Nio2Endpoint extends 
AbstractJsseEndpoint 0) {
 completion.completed(Long.valueOf(nBytes), this);


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 8.5.x updated: Add reference to CVE-2019-0221

2019-05-17 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 3918206  Add reference to CVE-2019-0221
3918206 is described below

commit 3918206ad9aa06270ccefe2b9a51ac286dc47bd8
Author: Mark Thomas 
AuthorDate: Fri May 17 11:08:01 2019 +0100

Add reference to CVE-2019-0221
---
 webapps/docs/changelog.xml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 22eb3a0..5338c5a 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -269,7 +269,8 @@
 configured to validate XML configuration files such as web.xml. (markt)
   
   
-Encode the output of the SSI printenv command. (markt)
+Encode the output of the SSI printenv command. This is the
+fix for CVE-2019-0221. (markt)
   
   
 Use constants for SSI encoding values. (markt)


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 7.0.x updated: Add reference to CVE-2019-0221

2019-05-17 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
 new 915095b  Add reference to CVE-2019-0221
915095b is described below

commit 915095b3d0a0943f20c68e8afd19fc9de4b6785e
Author: Mark Thomas 
AuthorDate: Fri May 17 11:08:08 2019 +0100

Add reference to CVE-2019-0221
---
 webapps/docs/changelog.xml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 972ada6..3a4eafd 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -230,7 +230,8 @@
 configured to validate XML configuration files such as web.xml. (markt)
   
   
-Encode the output of the SSI printenv command. (markt)
+Encode the output of the SSI printenv command. This is the
+fix for CVE-2019-0221. (markt)
   
   
 Use constants for SSI encoding values. (markt)


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1859425 - in /tomcat/site/trunk: docs/security-7.html docs/security-8.html docs/security-9.html xdocs/security-7.xml xdocs/security-8.xml xdocs/security-9.xml

2019-05-17 Thread markt
Author: markt
Date: Fri May 17 10:09:40 2019
New Revision: 1859425

URL: http://svn.apache.org/viewvc?rev=1859425=rev
Log:
Publish details of CVE-2019-0221

Modified:
tomcat/site/trunk/docs/security-7.html
tomcat/site/trunk/docs/security-8.html
tomcat/site/trunk/docs/security-9.html
tomcat/site/trunk/xdocs/security-7.xml
tomcat/site/trunk/xdocs/security-8.xml
tomcat/site/trunk/xdocs/security-9.xml

Modified: tomcat/site/trunk/docs/security-7.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/security-7.html?rev=1859425=1859424=1859425=diff
==
--- tomcat/site/trunk/docs/security-7.html (original)
+++ tomcat/site/trunk/docs/security-7.html Fri May 17 10:09:40 2019
@@ -435,6 +435,31 @@
 
 Affects: 7.0.0 to 7.0.93
 
+
+
+Low: XSS in SSI printenv
+   http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-0221; 
rel="nofollow">CVE-2019-0221
+
+
+
+The SSI printenv command echoes user provided data without escaping and
+   is, therefore, vulnerable to XSS. SSI is disabled by default. The
+   printenv command is intended for debugging and is unlikely to be present
+   in a production website.
+
+
+This was fixed with commit
+   https://github.com/apache/tomcat/commit/44ec74c;>44ec74c.
+
+
+This issue was identified by Nightwatch Cybersecurity Research and
+   reported to the Apache Tomcat security team via the bug bounty program
+   sponsored by the EU FOSSA-2 project on 7th March 2019. The issue was 
made
+   public on 17 May 2019.
+
+
+Affects: 7.0.0 to 7.0.93
+
   
 
 

Modified: tomcat/site/trunk/docs/security-8.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/security-8.html?rev=1859425=1859424=1859425=diff
==
--- tomcat/site/trunk/docs/security-8.html (original)
+++ tomcat/site/trunk/docs/security-8.html Fri May 17 10:09:40 2019
@@ -414,6 +414,31 @@
 
 Affects: 8.5.0 to 8.5.39
 
+
+
+Low: XSS in SSI printenv
+   http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-0221; 
rel="nofollow">CVE-2019-0221
+
+
+
+The SSI printenv command echoes user provided data without escaping and
+   is, therefore, vulnerable to XSS. SSI is disabled by default. The
+   printenv command is intended for debugging and is unlikely to be present
+   in a production website.
+
+
+This was fixed with commit
+   https://github.com/apache/tomcat/commit/4fcdf70;>4fcdf70.
+
+
+This issue was identified by Nightwatch Cybersecurity Research and
+   reported to the Apache Tomcat security team via the bug bounty program
+   sponsored by the EU FOSSA-2 project on 7th March 2019. The issue was 
made
+   public on 17 May 2019.
+
+
+Affects: 8.5.0 to 8.5.39
+
   
 
 

Modified: tomcat/site/trunk/docs/security-9.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/security-9.html?rev=1859425=1859424=1859425=diff
==
--- tomcat/site/trunk/docs/security-9.html (original)
+++ tomcat/site/trunk/docs/security-9.html Fri May 17 10:09:40 2019
@@ -327,7 +327,7 @@
 
 
 
-Note: The issue below was fixed in Apache Tomcat 9.0.18 but the
+Note: The issues below were fixed in Apache Tomcat 9.0.18 but the
release vote for the 9.0.18 release candidate did not pass. Therefore,
although users must download 9.0.19 to obtain a version that includes a
fix for these issues, version 9.0.18 is not included in the list of 
@@ -364,6 +364,31 @@
 
 
 Affects: 9.0.0.M1 to 9.0.17
+
+
+
+Low: XSS in SSI printenv
+   http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-0221; 
rel="nofollow">CVE-2019-0221
+
+
+
+The SSI printenv command echoes user provided data without escaping and
+   is, therefore, vulnerable to XSS. SSI is disabled by default. The
+   printenv command is intended for debugging and is unlikely to be present
+   in a production website.
+
+
+This was fixed with commit
+   https://github.com/apache/tomcat/commit/15fcd16;>15fcd16.
+
+
+This issue was identified by Nightwatch Cybersecurity Research and
+   reported to the Apache Tomcat security team via the bug bounty program
+   sponsored by the EU FOSSA-2 project on 7th March 2019. The issue was 
made
+   public on 17 May 2019.
+
+
+Affects: 9.0.0.M1 to 9.0.17
 
   
 

Modified: tomcat/site/trunk/xdocs/security-7.xml
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/xdocs/security-7.xml?rev=1859425=1859424=1859425=diff
==
--- tomcat/site/trunk/xdocs/security-7.xml (original)
+++ tomcat/site/trunk/xdocs/security-7.xml Fri May 17 10:09:40 2019
@@ -74,6 +74,24 @@
 
 Affects: 7.0.0 to 7.0.93
 
+Low: XSS in SSI printenv
+   CVE-2019-0221
+
+The 

[tomcat] branch master updated: Add reference to CVE-2019-0221

2019-05-17 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new b860700  Add reference to CVE-2019-0221
b860700 is described below

commit b860700fa5131fa6b83f34a23ab3d3d442233b4e
Author: Mark Thomas 
AuthorDate: Fri May 17 11:07:57 2019 +0100

Add reference to CVE-2019-0221
---
 webapps/docs/changelog.xml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 2aeb8c8..1b5f890 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -463,7 +463,8 @@
 configured to validate XML configuration files such as web.xml. (markt)
   
   
-Encode the output of the SSI printenv command. (markt)
+Encode the output of the SSI printenv command. This is the
+fix for CVE-2019-0221. (markt)
   
   
 Use constants for SSI encoding values. (markt)


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[CONF] Apache Tomcat > WebSocket TCK

2019-05-17 Thread Mark Thomas (Confluence)
Title: Message Title



 
 
 
There's 1 new edit on this page 
 
 
 
 
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
WebSocket TCK 
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
Mark Thomas edited this page 
 
 
  
 
 

 
 
 
  
 
 
  
 
 
  
 
 
 
 
 
 
 
 
 
 
Here's the version comment 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
 
  
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
Mark Thomas edited at 12:24 PM 
 
 
  
 
 

 
 
 
 
 
 
 
 
 Fix typo  
 
 
  
 
 
  
 
 

 
 
 
  
 
 
  
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Here's what changed: 
 
 
 
 
 
 
 
 
 
 
 ... 
 
4 x extensions (TCK assumes invalid extensions are ignored) 
1 x timeout related test expects more frequent expiration checks 
 2 Tests 'fixed' be by appropriate server.xml configuration ...  
 
 
  
 
 
  
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Go to page history 
 
 
  
 
 
  
 
 
  
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
View page 
 
 
  
 
 
  
 
 
  
 
 
  
 
 
 
 
 
 
 
 
 
 
Stop watching space
• 
 
 
 
 
 
 
Manage notifications 
 
 
 
 
 
 
 
 
 
 
  
 
 
This message was sent by Atlassian Confluence 6.15.2  
 
 
  
 
 
 
 
 
 
 
 
 




[tomcat] branch master updated: Remove comment

2019-05-17 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 41131b7  Remove comment
41131b7 is described below

commit 41131b791394d0fcb186c2fd63c4f0752a34ce16
Author: remm 
AuthorDate: Fri May 17 14:30:29 2019 +0200

Remove comment
---
 test/org/apache/tomcat/websocket/TestWebSocketFrameClientSSL.java | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/test/org/apache/tomcat/websocket/TestWebSocketFrameClientSSL.java 
b/test/org/apache/tomcat/websocket/TestWebSocketFrameClientSSL.java
index e1cffe8..ab12e0c 100644
--- a/test/org/apache/tomcat/websocket/TestWebSocketFrameClientSSL.java
+++ b/test/org/apache/tomcat/websocket/TestWebSocketFrameClientSSL.java
@@ -87,9 +87,6 @@ public class TestWebSocketFrameClientSSL extends 
WebSocketBaseTest {
 }
 
 
-/*
- * TODO: Fails intermittently with NIO2.
- */
 @Test
 public void testBug56032() throws Exception {
 Tomcat tomcat = getTomcatInstance();


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[CONF] Apache Tomcat > Financial Summary

2019-05-17 Thread Mark Thomas (Confluence)
Title: Message Title



 
 
 
There's 1 new edit on this page 
 
 
 
 
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Financial Summary 
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
Mark Thomas edited this page 
 
 
  
 
 

 
 
 
  
 
 
  
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Here's what changed: 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 
 
Event 
Income 
Expense 
Net 
Running Total 
 
 
TomcatCon, London, 2017 
1000.00 
178.51 
821.49 
821.49 
 
 
Tomcat Training, Manchester, 2018 
900.86 
885.24 
15.62 
837.11 
 
 
Interest May'18 to Jul'18 
 0.43 
 - 
 0.43 
837.54 
 
 
Interest Aug '18 to May'19 
2.30 
- 
2.30 
839.84 
 
 
 
 
 
 
  
 
 
  
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Go to page history 
 
 
  
 
 
  
 
 
  
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
View page 
 
 
  
 
 
  
 
 
  
 
 
  
 
 
 
 
 
 
 
 
 
 
Stop watching space
• 
 
 
 
 
 
 
Manage notifications 
 
 
 
 
 
 
 
 
 
 
  
 
 
This message was sent by Atlassian Confluence 6.15.2  
 
 
  
 
 
 
 
 
 
 
 
 




buildbot failure in on tomcat-trunk

2019-05-17 Thread buildbot
The Buildbot has detected a new failure on builder tomcat-trunk while building 
tomcat. Full details are available at:
https://ci.apache.org/builders/tomcat-trunk/builds/4366

Buildbot URL: https://ci.apache.org/

Buildslave for this Build: silvanus_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' 
triggered this build
Build Source Stamp: [branch master] b860700fa5131fa6b83f34a23ab3d3d442233b4e
Blamelist: Mark Thomas 

BUILD FAILED: failed compile_1

Sincerely,
 -The Buildbot




-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



buildbot success in on tomcat-trunk

2019-05-17 Thread buildbot
The Buildbot has detected a restored build on builder tomcat-trunk while 
building tomcat. Full details are available at:
https://ci.apache.org/builders/tomcat-trunk/builds/4367

Buildbot URL: https://ci.apache.org/

Buildslave for this Build: silvanus_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' 
triggered this build
Build Source Stamp: [branch master] c946142b886e1c103fd1ad992f5cb9c6604b99f1
Blamelist: remm 

Build succeeded!

Sincerely,
 -The Buildbot




-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: [tomcat] branch master updated: Add comment to unreachable code

2019-05-17 Thread Mark Thomas
On 17/05/2019 17:25, ma...@apache.org wrote:
> This is an automated email from the ASF dual-hosted git repository.
> 
> markt pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/tomcat.git
> 
> 
> The following commit(s) were added to refs/heads/master by this push:
>  new 21ee1c0  Add comment to unreachable code
> 21ee1c0 is described below
> 
> commit 21ee1c0b33aed7908a7aa5f415ff8775cfd92119
> Author: Mark Thomas 
> AuthorDate: Fri May 17 17:25:09 2019 +0100
> 
> Add comment to unreachable code
> 
> Identified by Coverity Scan
> ---
>  java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git 
> a/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java 
> b/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
> index 0cd91ef..cdf0e82 100644
> --- a/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
> +++ b/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
> @@ -81,6 +81,7 @@ public class WsRemoteEndpointImplServer extends 
> WsRemoteEndpointImplBase {
>  } else {
>  this.handler = handler;
>  if (timeout > 0) {
> +// TODO This block is unreachable

It wasn't immediately obvious to me what to do with this so I added a
comment as a marker.

Mark

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 7.0.x updated: Fix rare potential NPE identified by Coverity Scan.

2019-05-17 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
 new c043c29  Fix rare potential NPE identified by Coverity Scan.
c043c29 is described below

commit c043c290bd5378216820ccfa25cc795d27d86140
Author: Mark Thomas 
AuthorDate: Fri May 17 18:05:46 2019 +0100

Fix rare potential NPE identified by Coverity Scan.
---
 java/org/apache/catalina/connector/CoyoteAdapter.java | 6 --
 webapps/docs/changelog.xml| 4 
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java 
b/java/org/apache/catalina/connector/CoyoteAdapter.java
index dd0425a..9b3aa26 100644
--- a/java/org/apache/catalina/connector/CoyoteAdapter.java
+++ b/java/org/apache/catalina/connector/CoyoteAdapter.java
@@ -886,7 +886,7 @@ public class CoyoteAdapter implements Adapter {
 if (wrapper != null) {
 String[] methods = wrapper.getServletMethods();
 if (methods != null) {
-for (int i=0; i
+  
+Avoid potential NullPointerException when generating an
+HTTP Allow header. Identified by Coverity Scan. (markt)
+  
 
   
   


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: [tomcat] branch master updated: Add comment to unreachable code

2019-05-17 Thread Rémy Maucherat
On Fri, May 17, 2019 at 6:27 PM Mark Thomas  wrote:

> On 17/05/2019 17:25, ma...@apache.org wrote:
> > This is an automated email from the ASF dual-hosted git repository.
> >
> > markt pushed a commit to branch master
> > in repository https://gitbox.apache.org/repos/asf/tomcat.git
> >
> >
> > The following commit(s) were added to refs/heads/master by this push:
> >  new 21ee1c0  Add comment to unreachable code
> > 21ee1c0 is described below
> >
> > commit 21ee1c0b33aed7908a7aa5f415ff8775cfd92119
> > Author: Mark Thomas 
> > AuthorDate: Fri May 17 17:25:09 2019 +0100
> >
> > Add comment to unreachable code
> >
> > Identified by Coverity Scan
> > ---
> >  java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
> | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git
> a/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
> b/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
> > index 0cd91ef..cdf0e82 100644
> > ---
> a/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
> > +++
> b/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
> > @@ -81,6 +81,7 @@ public class WsRemoteEndpointImplServer extends
> WsRemoteEndpointImplBase {
> >  } else {
> >  this.handler = handler;
> >  if (timeout > 0) {
> > +// TODO This block is unreachable
>
> It wasn't immediately obvious to me what to do with this so I added a
> comment as a marker.
>

I don't remember what I meant to do there. I will investigate and fix it.

Rémy


[tomcat] branch 8.5.x updated: Fix rare potential NPE identified by Coverity Scan.

2019-05-17 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new c14bc02  Fix rare potential NPE identified by Coverity Scan.
c14bc02 is described below

commit c14bc021f8337873f850db4cd05a0451d484a8ed
Author: Mark Thomas 
AuthorDate: Fri May 17 18:05:46 2019 +0100

Fix rare potential NPE identified by Coverity Scan.
---
 java/org/apache/catalina/connector/CoyoteAdapter.java | 6 --
 webapps/docs/changelog.xml| 4 
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java 
b/java/org/apache/catalina/connector/CoyoteAdapter.java
index 50f68ec..a2a59bb 100644
--- a/java/org/apache/catalina/connector/CoyoteAdapter.java
+++ b/java/org/apache/catalina/connector/CoyoteAdapter.java
@@ -817,7 +817,7 @@ public class CoyoteAdapter implements Adapter {
 if (wrapper != null) {
 String[] methods = wrapper.getServletMethods();
 if (methods != null) {
-for (int i=0; i
+  
+Avoid potential NullPointerException when generating an
+HTTP Allow header. Identified by Coverity Scan. (markt)
+  
 
   
   


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch master updated: Fix async writes

2019-05-17 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 2894522  Fix async writes
2894522 is described below

commit 2894522060492b8d7f983aab5df4462b9f34d13c
Author: remm 
AuthorDate: Fri May 17 20:57:42 2019 +0200

Fix async writes
---
 java/org/apache/tomcat/util/net/AprEndpoint.java | 31 ++--
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java 
b/java/org/apache/tomcat/util/net/AprEndpoint.java
index c577257..d61febc 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -2763,6 +2763,7 @@ public class AprEndpoint extends 
AbstractEndpoint implements SNICallB
 
 private class AprOperationState extends OperationState {
 private volatile boolean inline = true;
+private volatile long flushBytes = 0;
 private AprOperationState(boolean read, ByteBuffer[] buffers, int 
offset, int length,
 BlockingMode block, long timeout, TimeUnit unit, A 
attachment, CompletionCheck check,
 CompletionHandler handler, Semaphore 
semaphore,
@@ -2800,21 +2801,35 @@ public class AprEndpoint extends 
AbstractEndpoint implements SNICallB
 break;
 }
 }
-if (buffer == null) {
+if (buffer == null && flushBytes == 0) {
 // Nothing to do
 return;
 }
 if (read) {
 nBytes = read(false, buffer);
 } else {
-if (!flush(false)) {
-int remaining = buffer.remaining();
-writeNonBlockingDirect(buffer);
-nBytes = remaining - buffer.remaining();
-if (nBytes > 0 && !buffer.isDirect() && 
flush(block == BlockingMode.BLOCK)) {
-inline = false;
-registerWriteInterest();
+if (!flush(block == BlockingMode.BLOCK)) {
+if (flushBytes > 0) {
+// Flushing was done, continue 
processing
+nBytes = flushBytes;
+flushBytes = 0;
+} else {
+int remaining = buffer.remaining();
+write(block == BlockingMode.BLOCK, 
buffer);
+nBytes = remaining - 
buffer.remaining();
+if (nBytes > 0 && flush(block == 
BlockingMode.BLOCK)) {
+// We have to flush and it's 
incomplete, save the bytes written until done
+inline = false;
+registerWriteInterest();
+flushBytes = nBytes;
+return;
+}
 }
+} else {
+// Continue flushing
+inline = false;
+registerWriteInterest();
+return;
 }
 }
 if (nBytes != 0) {


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch master updated: Ensure that the entire global XSLT file is read if one is defined.

2019-05-17 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 9f8e9c8  Ensure that the entire global XSLT file is read if one is 
defined.
9f8e9c8 is described below

commit 9f8e9c8af4ec1f3837279af4ebff89bf5dae29ac
Author: Mark Thomas 
AuthorDate: Fri May 17 17:03:56 2019 +0100

Ensure that the entire global XSLT file is read if one is defined.

Identified by Coverity Scan.
---
 .../org/apache/catalina/servlets/DefaultServlet.java | 16 +++-
 java/org/apache/catalina/util/IOTools.java   | 20 
 webapps/docs/changelog.xml   |  4 
 3 files changed, 35 insertions(+), 5 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 2e669d4..1060b9b 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -74,6 +74,7 @@ import org.apache.catalina.WebResource;
 import org.apache.catalina.WebResourceRoot;
 import org.apache.catalina.connector.RequestFacade;
 import org.apache.catalina.connector.ResponseFacade;
+import org.apache.catalina.util.IOTools;
 import org.apache.catalina.util.ServerInfo;
 import org.apache.catalina.util.URLEncoder;
 import org.apache.catalina.webresources.CachedResource;
@@ -2087,11 +2088,16 @@ public class DefaultServlet extends HttpServlet {
  */
 if (globalXsltFile != null) {
 File f = validateGlobalXsltFile();
-if (f != null){
-try (FileInputStream fis = new FileInputStream(f)){
-byte b[] = new byte[(int)f.length()]; /* danger! */
-fis.read(b);
-return new StreamSource(new ByteArrayInputStream(b));
+if (f != null) {
+long globalXsltFileSize = f.length();
+if (globalXsltFileSize > Integer.MAX_VALUE) {
+log("globalXsltFile [" + f.getAbsolutePath() + "] is too 
big to buffer");
+} else {
+try (FileInputStream fis = new FileInputStream(f)){
+byte b[] = new byte[(int)f.length()];
+IOTools.readFully(fis, b);
+return new StreamSource(new ByteArrayInputStream(b));
+}
 }
 }
 }
diff --git a/java/org/apache/catalina/util/IOTools.java 
b/java/org/apache/catalina/util/IOTools.java
index 83852c2..22ba06f 100644
--- a/java/org/apache/catalina/util/IOTools.java
+++ b/java/org/apache/catalina/util/IOTools.java
@@ -87,4 +87,24 @@ public class IOTools {
 }
 }
 }
+
+
+/**
+ * Read until EOF or the buffer is filled.
+ *
+ * @param isThe source to read from
+ * @param buf   The buffer to write to
+ *
+ * @return The number of bytes read
+ *
+ * @throws IOException If an I/O error occurs during the read
+ */
+public static int readFully(InputStream is, byte[] buf) throws IOException 
{
+int bytesRead = 0;
+int read;
+while (bytesRead < buf.length && ((read = is.read(buf, bytesRead, 
buf.length - bytesRead)) >= 0)) {
+bytesRead += read;
+}
+return bytesRead;
+}
 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 1b5f890..712c698 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -68,6 +68,10 @@
 servlet for the rarely used UTF-32 encodings. Identified by Coverity
 Scan. (markt)
   
+  
+Ensure that the default servlet reads the entire global XSLT file if
+one is defined. Identified by Coverity Scan. (markt)
+  
 
   
   


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch master updated: Add comment to unreachable code

2019-05-17 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 21ee1c0  Add comment to unreachable code
21ee1c0 is described below

commit 21ee1c0b33aed7908a7aa5f415ff8775cfd92119
Author: Mark Thomas 
AuthorDate: Fri May 17 17:25:09 2019 +0100

Add comment to unreachable code

Identified by Coverity Scan
---
 java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java 
b/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
index 0cd91ef..cdf0e82 100644
--- a/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
+++ b/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
@@ -81,6 +81,7 @@ public class WsRemoteEndpointImplServer extends 
WsRemoteEndpointImplBase {
 } else {
 this.handler = handler;
 if (timeout > 0) {
+// TODO This block in unreachable
 // Register with timeout thread
 timeoutExpiry = timeout + System.currentTimeMillis();
 wsWriteTimeout.register(this);


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 8.5.x updated: Ensure that the entire global XSLT file is read if one is defined.

2019-05-17 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 58e53d7  Ensure that the entire global XSLT file is read if one is 
defined.
58e53d7 is described below

commit 58e53d732a97c8b7ab04c9b5162eed65933bbcf0
Author: Mark Thomas 
AuthorDate: Fri May 17 17:03:56 2019 +0100

Ensure that the entire global XSLT file is read if one is defined.

Identified by Coverity Scan.
---
 .../org/apache/catalina/servlets/DefaultServlet.java | 16 +++-
 java/org/apache/catalina/util/IOTools.java   | 20 
 webapps/docs/changelog.xml   |  4 
 3 files changed, 35 insertions(+), 5 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 5920470..9aa9950 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -72,6 +72,7 @@ import org.apache.catalina.WebResource;
 import org.apache.catalina.WebResourceRoot;
 import org.apache.catalina.connector.RequestFacade;
 import org.apache.catalina.connector.ResponseFacade;
+import org.apache.catalina.util.IOTools;
 import org.apache.catalina.util.ServerInfo;
 import org.apache.catalina.util.URLEncoder;
 import org.apache.catalina.webresources.CachedResource;
@@ -1990,11 +1991,16 @@ public class DefaultServlet extends HttpServlet {
  */
 if (globalXsltFile != null) {
 File f = validateGlobalXsltFile();
-if (f != null){
-try (FileInputStream fis = new FileInputStream(f)){
-byte b[] = new byte[(int)f.length()]; /* danger! */
-fis.read(b);
-return new StreamSource(new ByteArrayInputStream(b));
+if (f != null) {
+long globalXsltFileSize = f.length();
+if (globalXsltFileSize > Integer.MAX_VALUE) {
+log("globalXsltFile [" + f.getAbsolutePath() + "] is too 
big to buffer");
+} else {
+try (FileInputStream fis = new FileInputStream(f)){
+byte b[] = new byte[(int)f.length()];
+IOTools.readFully(fis, b);
+return new StreamSource(new ByteArrayInputStream(b));
+}
 }
 }
 }
diff --git a/java/org/apache/catalina/util/IOTools.java 
b/java/org/apache/catalina/util/IOTools.java
index 83852c2..22ba06f 100644
--- a/java/org/apache/catalina/util/IOTools.java
+++ b/java/org/apache/catalina/util/IOTools.java
@@ -87,4 +87,24 @@ public class IOTools {
 }
 }
 }
+
+
+/**
+ * Read until EOF or the buffer is filled.
+ *
+ * @param isThe source to read from
+ * @param buf   The buffer to write to
+ *
+ * @return The number of bytes read
+ *
+ * @throws IOException If an I/O error occurs during the read
+ */
+public static int readFully(InputStream is, byte[] buf) throws IOException 
{
+int bytesRead = 0;
+int read;
+while (bytesRead < buf.length && ((read = is.read(buf, bytesRead, 
buf.length - bytesRead)) >= 0)) {
+bytesRead += read;
+}
+return bytesRead;
+}
 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 5338c5a..4041c50 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -50,6 +50,10 @@
   
 57287: Add file sorting to DefaultServlet (schultz)
   
+  
+Ensure that the default servlet reads the entire global XSLT file if
+one is defined. Identified by Coverity Scan. (markt)
+  
 
   
   


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: [tomcat] branch master updated: Add comment to unreachable code

2019-05-17 Thread Mark Thomas
On 17/05/2019 18:08, Rémy Maucherat wrote:
> On Fri, May 17, 2019 at 6:27 PM Mark Thomas  > wrote:
> 
> On 17/05/2019 17:25, ma...@apache.org  wrote:
> > This is an automated email from the ASF dual-hosted git repository.
> >
> > markt pushed a commit to branch master
> > in repository https://gitbox.apache.org/repos/asf/tomcat.git
> >
> >
> > The following commit(s) were added to refs/heads/master by this push:
> >      new 21ee1c0  Add comment to unreachable code
> > 21ee1c0 is described below
> >
> > commit 21ee1c0b33aed7908a7aa5f415ff8775cfd92119
> > Author: Mark Thomas mailto:ma...@apache.org>>
> > AuthorDate: Fri May 17 17:25:09 2019 +0100
> >
> >     Add comment to unreachable code
> >     
> >     Identified by Coverity Scan
> > ---
> > 
> java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
> | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git
> a/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
> b/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
> > index 0cd91ef..cdf0e82 100644
> > ---
> a/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
> > +++
> b/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
> > @@ -81,6 +81,7 @@ public class WsRemoteEndpointImplServer extends
> WsRemoteEndpointImplBase {
> >              } else {
> >                  this.handler = handler;
> >                  if (timeout > 0) {
> > +                    // TODO This block is unreachable
> 
> It wasn't immediately obvious to me what to do with this so I added a
> comment as a marker.
> 
> 
> I don't remember what I meant to do there. I will investigate and fix it.

Thanks.

Mark

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 7.0.x updated: Ensure that the entire global XSLT file is read if one is defined.

2019-05-17 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
 new bbf76e4  Ensure that the entire global XSLT file is read if one is 
defined.
bbf76e4 is described below

commit bbf76e4c301197cd0c12299cf495d988283616f9
Author: Mark Thomas 
AuthorDate: Fri May 17 17:03:56 2019 +0100

Ensure that the entire global XSLT file is read if one is defined.

Identified by Coverity Scan.
---
 .../apache/catalina/servlets/DefaultServlet.java   | 29 +-
 java/org/apache/catalina/util/IOTools.java | 20 +++
 webapps/docs/changelog.xml |  4 +++
 3 files changed, 41 insertions(+), 12 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 02e4e9e..16ba71d 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -68,6 +68,7 @@ import javax.xml.transform.stream.StreamSource;
 import org.apache.catalina.Globals;
 import org.apache.catalina.connector.RequestFacade;
 import org.apache.catalina.connector.ResponseFacade;
+import org.apache.catalina.util.IOTools;
 import org.apache.catalina.util.RequestUtil;
 import org.apache.catalina.util.ServerInfo;
 import org.apache.catalina.util.URLEncoder;
@@ -1745,17 +1746,22 @@ public class DefaultServlet
 File f = validateGlobalXsltFile();
 if (f != null){
 FileInputStream fis = null;
-try {
-fis = new FileInputStream(f);
-byte b[] = new byte[(int)f.length()]; /* danger! */
-fis.read(b);
-return new StreamSource(new ByteArrayInputStream(b));
-} finally {
-if (fis != null) {
-try {
-fis.close();
-} catch (IOException ioe) {
-// Ignore
+long globalXsltFileSize = f.length();
+if (globalXsltFileSize > Integer.MAX_VALUE) {
+log("globalXsltFile [" + f.getAbsolutePath() + "] is too 
big to buffer");
+} else {
+try {
+fis = new FileInputStream(f);
+byte b[] = new byte[(int)f.length()];
+IOTools.readFully(fis, b);
+return new StreamSource(new ByteArrayInputStream(b));
+} finally {
+if (fis != null) {
+try {
+fis.close();
+} catch (IOException ioe) {
+// Ignore
+}
 }
 }
 }
@@ -1763,7 +1769,6 @@ public class DefaultServlet
 }
 
 return null;
-
 }
 
 
diff --git a/java/org/apache/catalina/util/IOTools.java 
b/java/org/apache/catalina/util/IOTools.java
index 77090dd..d7ae3bb 100644
--- a/java/org/apache/catalina/util/IOTools.java
+++ b/java/org/apache/catalina/util/IOTools.java
@@ -86,4 +86,24 @@ public class IOTools {
 byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
 flow( is, os, buf );
 }
+
+
+/**
+ * Read until EOF or the buffer is filled.
+ *
+ * @param isThe source to read from
+ * @param buf   The buffer to write to
+ *
+ * @return The number of bytes read
+ *
+ * @throws IOException If an I/O error occurs during the read
+ */
+public static int readFully(InputStream is, byte[] buf) throws IOException 
{
+int bytesRead = 0;
+int read;
+while (bytesRead < buf.length && ((read = is.read(buf, bytesRead, 
buf.length - bytesRead)) >= 0)) {
+bytesRead += read;
+}
+return bytesRead;
+}
 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 3a4eafd..50b4a15 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -100,6 +100,10 @@
 serialization with mem-cached. Patch provided by Martin Lemanski.
 (markt)
   
+  
+Ensure that the default servlet reads the entire global XSLT file if
+one is defined. Identified by Coverity Scan. (markt)
+  
 
   
   


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch master updated: Fix rare potential NPE identified by Coverity Scan.

2019-05-17 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 0483c93  Fix rare potential NPE identified by Coverity Scan.
0483c93 is described below

commit 0483c93ddd4ab0ac7742e154d1e1e1b3c4475f6c
Author: Mark Thomas 
AuthorDate: Fri May 17 18:05:46 2019 +0100

Fix rare potential NPE identified by Coverity Scan.
---
 java/org/apache/catalina/connector/CoyoteAdapter.java | 6 --
 webapps/docs/changelog.xml| 4 
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java 
b/java/org/apache/catalina/connector/CoyoteAdapter.java
index fb4c236..de572e6 100644
--- a/java/org/apache/catalina/connector/CoyoteAdapter.java
+++ b/java/org/apache/catalina/connector/CoyoteAdapter.java
@@ -816,7 +816,7 @@ public class CoyoteAdapter implements Adapter {
 if (wrapper != null) {
 String[] methods = wrapper.getServletMethods();
 if (methods != null) {
-for (int i=0; i
+  
+Avoid potential NullPointerException when generating an
+HTTP Allow header. Identified by Coverity Scan. (markt)
+  
 
   
   


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch master updated: Fix timeout logic for async IO non blocking writes

2019-05-17 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 5a8c6a1  Fix timeout logic for async IO non blocking writes
5a8c6a1 is described below

commit 5a8c6a1d084881dcbd6c44e692baded9b7b6ba42
Author: remm 
AuthorDate: Fri May 17 20:29:09 2019 +0200

Fix timeout logic for async IO non blocking writes

Identified by Coverity Scan.
---
 .../tomcat/websocket/server/WsRemoteEndpointImplServer.java   | 3 +--
 webapps/docs/changelog.xml| 8 
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git 
a/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java 
b/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
index cdf0e82..c552d10 100644
--- a/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
+++ b/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
@@ -80,13 +80,12 @@ public class WsRemoteEndpointImplServer extends 
WsRemoteEndpointImplBase {
 }
 } else {
 this.handler = handler;
+timeout = getSendTimeout();
 if (timeout > 0) {
-// TODO This block in unreachable
 // Register with timeout thread
 timeoutExpiry = timeout + System.currentTimeMillis();
 wsWriteTimeout.register(this);
 }
-timeout = getSendTimeout();
 }
 socketWrapper.write(block ? BlockingMode.BLOCK : 
BlockingMode.SEMI_BLOCK, timeout,
 TimeUnit.MILLISECONDS, null, 
SocketWrapperBase.COMPLETE_WRITE_WITH_COMPLETION,
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 24cc2b0..055239f 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -173,6 +173,14 @@
   
 
   
+  
+
+  
+Fix timeout logic for async non blocking writes. Identified by
+Coverity Scan. (remm)
+  
+
+  
   
 
   


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org