[Bug 63354] forced compression in HTTP2 truncate files

2019-04-16 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63354

--- Comment #1 from Alejandro Anadon  ---
Hi,

I have been tying to detect the source of the problem; and it seem that it is
in  the Firefox , because in Crome it works perfect.

My firefox is:
firefox Quantum  66.0.3 (64-bits)

My OS is:
Windows 7 Profesional

-- 
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 63356] OCSP_parse_url error while parsing Authority Information Access extension

2019-04-16 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63356

--- Comment #3 from Christopher Schultz  ---
Created attachment 36532
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36532&action=edit
Patch to avoid empty URLs

It wasn't clear what the best way was to log debug information other than just
to stdout, so I'm including a one-liner patch that will hopefully avoid
attempts to parse a useless OCSP URL.

Let me know if it is useful to you.

-- 
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 63356] OCSP_parse_url error while parsing Authority Information Access extension

2019-04-16 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63356

--- Comment #2 from Charissa Willard  ---
Yes, we untar the source and then build like this:

Untar the source
tar -xvf tomcat-native_1.2.16.orig.tar.xz
tar -xvf tomcat-native_1.2.16-1build1.debian.tar.xz


Install APR
sudo apt-get install libapr1-dev

cd tomcat-native-1.2.16-src/native
./configure --with-java-home=/usr/lib/jvm/java-8-openjdk-amd64 --with-ssl=yes

make

-- 
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 63356] OCSP_parse_url error while parsing Authority Information Access extension

2019-04-16 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63356

--- Comment #1 from Christopher Schultz  ---
Fortunately, there is only a single code path where OCSP_parse_url is found, so
this ought to be easy to track down.

I can't see a code path where a NULL OCSP URL would be passed-into
OCSP_parse_url, but I could see where a zero-length string might be passed-in.

Are you able to build from source, and can I give you a patch to get some more
debugging information?

-- 
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 63356] OCSP_parse_url error while parsing Authority Information Access extension

2019-04-16 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63356

Charissa Willard  changed:

   What|Removed |Added

 CC||cwill...@blackridge.us

-- 
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 63356] New: OCSP_parse_url error while parsing Authority Information Access extension

2019-04-16 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63356

Bug ID: 63356
   Summary: OCSP_parse_url error while parsing Authority
Information Access extension
   Product: Tomcat Native
   Version: 1.2.16
  Hardware: Other
OS: Linux
Status: NEW
  Severity: major
  Priority: P2
 Component: Library
  Assignee: dev@tomcat.apache.org
  Reporter: cwill...@blackridge.us
  Target Milestone: ---

We had a customer that could not log into our web application from their
browser. The problem occurred during the full handshake between the 2 APR
connectors running in 2 separate webapp services in Tomcat: the webui client
socket (port 8445) and our rest api server socket (port 8443). 

The error below indicates there was a malloc issue while parsing the OCSP entry
in the AuthorityInfoAccess extension. The catalina.out file contained this
“Handshake failed” message:

Apr 08, 2019 10:59:04 PM org.apache.tomcat.util.net.AprEndpoint
setSocketOptions
FINE: Handshake failed: error:27072041:OCSP routines:OCSP_parse_url:malloc
failure

There did not appear to be a malloc issue. There was plenty of memory available
when I ran top when this problem occurred. 

The few tcpdump dumps we have all show that the server port (8443) does a
FIN/ACK followed by a RST after it issues a Server Hello Done and receives the
client’s certificate. There is no alert in the tcpdump. Note that the log level
of this error message is FINE (DEBUG), but for a handshake failure, I would
expect a log level of SEVERE (ERROR).

I contacted SafeLogic which handles our openssl package. They said it appears
that Tomcat Native retrieves the OCSP url from the Authority Information Access
X509 extension using its own parsing routines. It then calls the OpenSSL
function OCSP_parse_url with the resulting url. The certificate did not contain
an OCSP access entry in its Authority Information Access (AIA) extension. It
only contained a CA-Issuers access entry. SafeLogic suspected that for this
case Tomcat is passing a NULL url to OCSP_parse_url(), which would result in
the above openssl error. The AIA entry in the certificate is as follows:

Authority Information Access:
CA Issuers –
URI:http://wxyz-dc-01.wxyz.local/pki/WXYZ-DC-01.WXYZ.local_IssuingCA.crt

We compiled libtcnative with OCSP disabled and the customer was able to log
into the system in question.

Software Versions:

Tomcat 8.5.30
libtcnative-1_1.2.16F with APR FIPS-140 support
openssl 1.0.2n
Java 1.8.0_131
Ubuntu 16.04

-- 
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 master updated: Another round of cleanups

2019-04-16 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 d7a770a  Another round of cleanups
d7a770a is described below

commit d7a770acf8761c42958b56d6ce4864e32f8a9957
Author: remm 
AuthorDate: Tue Apr 16 14:44:06 2019 +0200

Another round of cleanups

Almost no code change except removing needless exception nesting in
cancelledKey. Add a little i18n since a string was used way too often to
mean something. Some formatting and variable names.
---
 .../apache/tomcat/util/net/LocalStrings.properties |  2 +
 java/org/apache/tomcat/util/net/Nio2Endpoint.java  |  6 +--
 java/org/apache/tomcat/util/net/NioEndpoint.java   | 54 +-
 3 files changed, 27 insertions(+), 35 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/LocalStrings.properties 
b/java/org/apache/tomcat/util/net/LocalStrings.properties
index 100efd3..268785e 100644
--- a/java/org/apache/tomcat/util/net/LocalStrings.properties
+++ b/java/org/apache/tomcat/util/net/LocalStrings.properties
@@ -64,6 +64,7 @@ endpoint.apr.remoteport=APR socket [{0}] opened with remote 
port [{1}]
 endpoint.apr.tooManyCertFiles=More certificate files were configured than the 
AprEndpoint can handle
 endpoint.debug.channelCloseFail=Failed to close channel
 endpoint.debug.destroySocket=Destroying socket [{0}]
+endpoint.debug.handlerRelease=Handler failed to release socket wrapper
 endpoint.debug.pollerAdd=Add to addList socket [{0}], timeout [{1}], flags 
[{2}]
 endpoint.debug.pollerAddDo=Add to poller socket [{0}]
 endpoint.debug.pollerProcess=Processing socket [{0}] for event(s) [{1}]
@@ -115,6 +116,7 @@ endpoint.processing.fail=Error running socket processor
 endpoint.rejectedExecution=Socket processing request was rejected for [{0}]
 endpoint.removeDefaultSslHostConfig=The default SSLHostConfig (named [{0}]) 
may not be removed
 endpoint.sendfile.addfail=Sendfile failure: [{0}] [{1}]
+endpoint.sendfile.closeError=Error closing sendfile resources
 endpoint.sendfile.error=Unexpected sendfile error
 endpoint.sendfile.tooMuchData=Sendfile configured to send more data than was 
available
 endpoint.sendfileThreadStop=The sendfile thread failed to stop in a timely 
manner
diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java 
b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
index 370934d..65cdf4b 100644
--- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java
+++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
@@ -902,7 +902,7 @@ public class Nio2Endpoint extends 
AbstractJsseEndpoint
 }
 socketWrapper = (NioSocketWrapper) sk.attach(null);
 if (socketWrapper != null) {
-try {
-socketWrapper.close();
-} catch (Exception e) {
-if (log.isDebugEnabled()) {
-log.debug(sm.getString(
-"endpoint.debug.channelCloseFail"), e);
-}
-}
+socketWrapper.close();
 }
 if (sk.isValid()) {
 sk.cancel();
@@ -702,19 +695,12 @@ public class NioEndpoint extends 
AbstractJsseEndpoint
 // The SocketChannel is also available via the SelectionKey. If
 // it hasn't been closed in the block above, close it now.
 if (sk.channel().isOpen()) {
-try {
-sk.channel().close();
-} catch (Exception e) {
-if (log.isDebugEnabled()) {
-log.debug(sm.getString(
-"endpoint.debug.channelCloseFail"), e);
-}
-}
+sk.channel().close();
 }
 } catch (Throwable e) {
 ExceptionUtils.handleThrowable(e);
 if (log.isDebugEnabled()) {
-log.error("", e);
+log.error(sm.getString("endpoint.debug.channelCloseFail"), 
e);
 }
 }
 return socketWrapper;
@@ -760,7 +746,9 @@ public class NioEndpoint extends 
AbstractJsseEndpoint
 continue;
 }
 // Either we timed out or we woke up, process events first
-if ( keyCount == 0 ) hasEvents = (hasEvents | events());
+if (keyCount == 0) {
+hasEvents = (hasEvents | events());
+}
 
 Iterator iterator =
 keyCount > 0 ? selector.selectedKeys().iterator() : null;
@@ -768,14 +756,14 @@ public class NioEndpoint extends 
AbstractJsseEndpoint
 // any active event.
 while 

buildbot success in on tomcat-trunk

2019-04-16 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/4221

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] 86b0e874552675dcc12924eb297e2568e1c3c3d7
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



SSLv2Hello "Protocol" Support

2019-04-16 Thread Coty Sutherland
Hi,

It appears that the IBM JDK (version 8) has dropped support for SSLv2Hello
so when you startup tomcat with the IBM JDK you get a warning saying that
the protocol is being skipped. OpenJDK seems to have dropped it in version
12 or 13 (I haven't tested, just noticed a user list thread about it) so I
guess we should look at dropping support for SSLv2Hello whenever Tomcat's
minimum JDK is one of those versions? Is there a document somewhere I can
add this too so it doesn't get forgotten?



Thanks,
Coty


[tomcat] branch master updated: Return logging to normal for now

2019-04-16 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 86b0e87  Return logging to normal for now
86b0e87 is described below

commit 86b0e874552675dcc12924eb297e2568e1c3c3d7
Author: remm 
AuthorDate: Tue Apr 16 13:17:27 2019 +0200

Return logging to normal for now
---
 conf/logging.properties | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/conf/logging.properties b/conf/logging.properties
index fc52083..e8b7b16 100644
--- a/conf/logging.properties
+++ b/conf/logging.properties
@@ -73,7 +73,7 @@ 
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].ha
 #org.apache.jasper.compiler.TldLocationsCache.level = FINE
 
 # To see debug messages for HTTP/2 handling, uncomment the following line:
-org.apache.coyote.http2.level = FINE
+#org.apache.coyote.http2.level = FINE
 
 # To see debug messages for WebSocket handling, uncomment the following line:
 #org.apache.tomcat.websocket.level = FINE


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



[Bug 63354] New: forced compression in HTTP2 truncate files

2019-04-16 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63354

Bug ID: 63354
   Summary: forced compression in HTTP2 truncate files
   Product: Tomcat 9
   Version: 9.0.19
  Hardware: All
OS: Linux
Status: NEW
  Severity: major
  Priority: P2
 Component: Connectors
  Assignee: dev@tomcat.apache.org
  Reporter: a...@enforex.es
  Target Milestone: -

Created attachment 36528
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36528&action=edit
Example of truncated file by tomcat when compression="force" is in
UpgradeProtocol

if I configure the conector following this guide:
https://tomcat.apache.org/tomcat-9.0-doc/config/http2.html
and I use compression="force" in UpgradeProtocol , for example:
---






---

If I use a html file that contents small text, It trunkates the text.

for example, if the jsp is (without coutes):
"B999000aaabbbccc111222333444555666777888999000abcd efghij kl mnopqr stuvwxyza
bc deE"

It returns:
"B999000aaabbbccc111222333444555666777888999000abcd efghij kl mnopqr stuvwxyza
bc " 
removing the ending text "deE".

I detected sevaral file with same error, but this is the simples example that I
found.

-- 
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



buildbot failure in on tomcat-trunk

2019-04-16 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/4220

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] d9bff97b2861dd390ed96f29f4d005ae87a9fc33
Blamelist: remm 

BUILD FAILED: failed shell_10

Sincerely,
 -The Buildbot




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



[tomcat] branch master updated: Fix changelog entry icon.

2019-04-16 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 d9bff97  Fix changelog entry icon.
d9bff97 is described below

commit d9bff97b2861dd390ed96f29f4d005ae87a9fc33
Author: remm 
AuthorDate: Tue Apr 16 11:01:39 2019 +0200

Fix changelog entry icon.
---
 webapps/docs/changelog.xml | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index de56186..45ab3a8 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -47,9 +47,11 @@
 
   
 
-  Fix some edge cases where the docBase was not being set using a canonical
-  path which in turn meant resource URLs were not being constructed as
-  expected. (markt)
+  
+Fix some edge cases where the docBase was not being set using a 
canonical
+path which in turn meant resource URLs were not being constructed as
+expected. (markt)
+  
 
   
   


-
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-04-16 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/4218

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] 0ead8c800696c53a66770dea1b86885a8971b316
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



[tomcat] branch master updated: Edit changelog entry

2019-04-16 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 187c152  Edit changelog entry
187c152 is described below

commit 187c152759e72908d7e90355145a7c2d412eb73a
Author: remm 
AuthorDate: Tue Apr 16 10:25:55 2019 +0200

Edit changelog entry

There was no general connection leak that I can reproduce anymore. As
NioSocketWrapper.close was only closing the channel, this is where the
root of the problem was.
---
 webapps/docs/changelog.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index a71fb58..de56186 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -59,7 +59,7 @@
 value now defaults to true. (remm)
   
   
-Possible HTTP/2 connection leak issue when using async. (remm)
+Possible HTTP/2 connection leak issue when using async with NIO. (remm)
   
   
 Fix socket close discrepancies for NIO, now the wrapper close


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



[tomcat] branch master updated: Revert processing change

2019-04-16 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 c3c6686  Revert processing change
c3c6686 is described below

commit c3c66860b8e994584bdfb7dd62c219f53967792e
Author: remm 
AuthorDate: Tue Apr 16 10:03:02 2019 +0200

Revert processing change

The close refactoring is enough to ensure connections are properly
closed.
---
 java/org/apache/coyote/http2/Http2AsyncParser.java | 8 +---
 java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2AsyncParser.java 
b/java/org/apache/coyote/http2/Http2AsyncParser.java
index 448f3ce..2c764f8 100644
--- a/java/org/apache/coyote/http2/Http2AsyncParser.java
+++ b/java/org/apache/coyote/http2/Http2AsyncParser.java
@@ -31,14 +31,16 @@ import 
org.apache.tomcat.util.net.SocketWrapperBase.CompletionState;
 class Http2AsyncParser extends Http2Parser {
 
 private final SocketWrapperBase socketWrapper;
+private final Http2AsyncUpgradeHandler upgradeHandler;
 private Throwable error = null;
 private final ByteBuffer header;
 private final ByteBuffer framePaylod;
 
-Http2AsyncParser(String connectionId, Input input, Output output, 
SocketWrapperBase socketWrapper) {
+Http2AsyncParser(String connectionId, Input input, Output output, 
SocketWrapperBase socketWrapper, Http2AsyncUpgradeHandler upgradeHandler) {
 super(connectionId, input, output);
 this.socketWrapper = socketWrapper;
 socketWrapper.getSocketBufferHandler().expand(input.getMaxFrameSize());
+this.upgradeHandler = upgradeHandler;
 header = ByteBuffer.allocate(9);
 framePaylod = ByteBuffer.allocate(input.getMaxFrameSize());
 }
@@ -226,7 +228,7 @@ class Http2AsyncParser extends Http2Parser {
 if (state == CompletionState.DONE) {
 // The call was not completed inline, so must start reading 
new frames
 // or process the stream exception
-socketWrapper.processSocket(SocketEvent.OPEN_READ, false);
+upgradeHandler.upgradeDispatch(SocketEvent.OPEN_READ);
 }
 }
 
@@ -238,7 +240,7 @@ class Http2AsyncParser extends Http2Parser {
 log.debug(sm.getString("http2Parser.error", connectionId, 
Integer.valueOf(streamId), frameType), e);
 }
 if (state == null || state == CompletionState.DONE) {
-socketWrapper.processSocket(SocketEvent.ERROR, true);
+upgradeHandler.upgradeDispatch(SocketEvent.ERROR);
 }
 }
 
diff --git a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
index de80eb1..f4559a3 100644
--- a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
@@ -69,7 +69,7 @@ public class Http2AsyncUpgradeHandler extends 
Http2UpgradeHandler {
 
 @Override
 protected Http2Parser getParser(String connectionId) {
-return new Http2AsyncParser(connectionId, this, this, socketWrapper);
+return new Http2AsyncParser(connectionId, this, this, socketWrapper, 
this);
 }
 
 


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



[tomcat] branch master updated: Remove debug ...

2019-04-16 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 0ead8c8  Remove debug ...
0ead8c8 is described below

commit 0ead8c800696c53a66770dea1b86885a8971b316
Author: remm 
AuthorDate: Tue Apr 16 09:46:41 2019 +0200

Remove debug ...
---
 java/org/apache/tomcat/util/net/NioEndpoint.java | 1 -
 1 file changed, 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java 
b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 56b49e3..07f3de4 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -989,7 +989,6 @@ public class NioEndpoint extends 
AbstractJsseEndpoint
 long timeout = socketWrapper.getReadTimeout();
 isTimedOut = timeout > 0 && delta > timeout;
 readTimeout = true;
-System.out.println("Timeout: " + timeout + " 
Delta: " + delta + " isTimedOut: " + isTimedOut);
 }
 // Check for write timeout
 if (!isTimedOut && (socketWrapper.interestOps() & 
SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE) {


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



[tomcat] branch master updated: Implement poller timeout with async

2019-04-16 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 0bd48ff  Implement poller timeout with async
0bd48ff is described below

commit 0bd48ff7c773cd6ef587df0f904111a741019530
Author: remm 
AuthorDate: Tue Apr 16 09:45:56 2019 +0200

Implement poller timeout with async

Updating the last operation time must be explicit when there is an IO
operation.
---
 java/org/apache/tomcat/util/net/NioEndpoint.java | 15 +++
 webapps/docs/changelog.xml   |  3 +++
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java 
b/java/org/apache/tomcat/util/net/NioEndpoint.java
index b869876..56b49e3 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -970,7 +970,7 @@ public class NioEndpoint extends 
AbstractJsseEndpoint
 keycount++;
 try {
 NioSocketWrapper socketWrapper = (NioSocketWrapper) 
key.attachment();
-if ( socketWrapper == null ) {
+if (socketWrapper == null) {
 // We don't support any keys without attachments
 cancelledKey(key);
 } else if (close) {
@@ -989,6 +989,7 @@ public class NioEndpoint extends 
AbstractJsseEndpoint
 long timeout = socketWrapper.getReadTimeout();
 isTimedOut = timeout > 0 && delta > timeout;
 readTimeout = true;
+System.out.println("Timeout: " + timeout + " 
Delta: " + delta + " isTimedOut: " + isTimedOut);
 }
 // Check for write timeout
 if (!isTimedOut && (socketWrapper.interestOps() & 
SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE) {
@@ -1003,15 +1004,19 @@ public class NioEndpoint extends 
AbstractJsseEndpoint
 socketWrapper.interestOps(0);
 socketWrapper.setError(new 
SocketTimeoutException());
 if (readTimeout && socketWrapper.readOperation 
!= null) {
-
getExecutor().execute(socketWrapper.readOperation);
+if 
(!socketWrapper.readOperation.process()) {
+cancelledKey(key);
+}
 } else if (writeTimeout && 
socketWrapper.writeOperation != null) {
-
getExecutor().execute(socketWrapper.writeOperation);
+if 
(!socketWrapper.writeOperation.process()) {
+cancelledKey(key);
+}
 } else if (!processSocket(socketWrapper, 
SocketEvent.ERROR, true)) {
 cancelledKey(key);
 }
 }
 }
-}catch ( CancelledKeyException ckx ) {
+} catch (CancelledKeyException ckx) {
 cancelledKey(key);
 }
 }
@@ -1491,8 +1496,10 @@ public class NioEndpoint extends 
AbstractJsseEndpoint
 try {
 if (read) {
 nBytes = getSocket().read(buffers, offset, length);
+updateLastRead();
 } else {
 nBytes = getSocket().write(buffers, offset, 
length);
+updateLastWrite();
 }
 } catch (IOException e) {
 setError(e);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 4def071..a71fb58 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -65,6 +65,9 @@
 Fix socket close discrepancies for NIO, now the wrapper close
 is used everywhere except for socket accept problems. (remm)
   
+  
+Implement poller timeout when using async IO with NIO. (remm)
+  
 
   
 


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