[tomcat] branch master updated: Don't activate Tomcat's GraalVM JNI resources by default
This is an automated email from the ASF dual-hosted git repository. mgrigorov 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 20edb41 Don't activate Tomcat's GraalVM JNI resources by default 20edb41 is described below commit 20edb410286fdfe141dc0178f361493d4f3ca72c Author: Martin Tzvetanov Grigorov AuthorDate: Wed Nov 11 10:06:31 2020 +0200 Don't activate Tomcat's GraalVM JNI resources by default If an application needs to use APR protocol then it could activate the JNI config by adding '-H:JNIConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/tomcat-jni.json' to native-image's arguments https://bz.apache.org/bugzilla/show_bug.cgi?id=64875 --- res/graal/tomcat-embed-core/native-image/native-image.properties | 2 +- webapps/docs/changelog.xml | 5 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/res/graal/tomcat-embed-core/native-image/native-image.properties b/res/graal/tomcat-embed-core/native-image/native-image.properties index 5cbfb55..8944701 100644 --- a/res/graal/tomcat-embed-core/native-image/native-image.properties +++ b/res/graal/tomcat-embed-core/native-image/native-image.properties @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -Args = -H:ReflectionConfigurationResources=${.}/tomcat-reflection.json -H:ResourceConfigurationResources=${.}/tomcat-resource.json -H:JNIConfigurationResources=${.}/tomcat-jni.json +Args = -H:ReflectionConfigurationResources=${.}/tomcat-reflection.json -H:ResourceConfigurationResources=${.}/tomcat-resource.json diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index c49ff08..a1b224c 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -85,7 +85,10 @@ Add GraalVM config for Tomcat JNI related classes. This makes it -possible to use the APR protocol in GraalVM native images. (mgrigorov) +possible to use the APR protocol in GraalVM native images. +To use it add the following to the native-image arguments: + -H:JNIConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/tomcat-jni.json +(mgrigorov) JNDIRealm connections should only be created with the container - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 9.0.x updated: Don't activate Tomcat's GraalVM JNI resources by default
This is an automated email from the ASF dual-hosted git repository. mgrigorov pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new 447d24c Don't activate Tomcat's GraalVM JNI resources by default 447d24c is described below commit 447d24c773dc9bafb7a37bbc583dea5242644065 Author: Martin Tzvetanov Grigorov AuthorDate: Wed Nov 11 10:06:31 2020 +0200 Don't activate Tomcat's GraalVM JNI resources by default If an application needs to use APR protocol then it could activate the JNI config by adding '-H:JNIConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/tomcat-jni.json' to native-image's arguments https://bz.apache.org/bugzilla/show_bug.cgi?id=64875 (cherry picked from commit 20edb410286fdfe141dc0178f361493d4f3ca72c) --- res/graal/tomcat-embed-core/native-image/native-image.properties | 2 +- webapps/docs/changelog.xml | 7 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/res/graal/tomcat-embed-core/native-image/native-image.properties b/res/graal/tomcat-embed-core/native-image/native-image.properties index 5cbfb55..8944701 100644 --- a/res/graal/tomcat-embed-core/native-image/native-image.properties +++ b/res/graal/tomcat-embed-core/native-image/native-image.properties @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -Args = -H:ReflectionConfigurationResources=${.}/tomcat-reflection.json -H:ResourceConfigurationResources=${.}/tomcat-resource.json -H:JNIConfigurationResources=${.}/tomcat-jni.json +Args = -H:ReflectionConfigurationResources=${.}/tomcat-reflection.json -H:ResourceConfigurationResources=${.}/tomcat-resource.json diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 0a1a928..84c09d0 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -80,8 +80,11 @@ HTML. (kfujino) -Add GraalVM config for Tomcat JNI related classes. This makes it possible to use the APR -protocol in GraalVM native images. (mgrigorov) +Add GraalVM config for Tomcat JNI related classes. This makes it +possible to use the APR protocol in GraalVM native images. +To use it add the following to the native-image arguments: + -H:JNIConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/tomcat-jni.json +(mgrigorov) JNDIRealm connections should only be created with the container - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 9.0.x updated: Don't activate Tomcat's GraalVM JNI resources by default
This is an automated email from the ASF dual-hosted git repository. mgrigorov pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new 447d24c Don't activate Tomcat's GraalVM JNI resources by default 447d24c is described below commit 447d24c773dc9bafb7a37bbc583dea5242644065 Author: Martin Tzvetanov Grigorov AuthorDate: Wed Nov 11 10:06:31 2020 +0200 Don't activate Tomcat's GraalVM JNI resources by default If an application needs to use APR protocol then it could activate the JNI config by adding '-H:JNIConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/tomcat-jni.json' to native-image's arguments https://bz.apache.org/bugzilla/show_bug.cgi?id=64875 (cherry picked from commit 20edb410286fdfe141dc0178f361493d4f3ca72c) --- res/graal/tomcat-embed-core/native-image/native-image.properties | 2 +- webapps/docs/changelog.xml | 7 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/res/graal/tomcat-embed-core/native-image/native-image.properties b/res/graal/tomcat-embed-core/native-image/native-image.properties index 5cbfb55..8944701 100644 --- a/res/graal/tomcat-embed-core/native-image/native-image.properties +++ b/res/graal/tomcat-embed-core/native-image/native-image.properties @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -Args = -H:ReflectionConfigurationResources=${.}/tomcat-reflection.json -H:ResourceConfigurationResources=${.}/tomcat-resource.json -H:JNIConfigurationResources=${.}/tomcat-jni.json +Args = -H:ReflectionConfigurationResources=${.}/tomcat-reflection.json -H:ResourceConfigurationResources=${.}/tomcat-resource.json diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 0a1a928..84c09d0 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -80,8 +80,11 @@ HTML. (kfujino) -Add GraalVM config for Tomcat JNI related classes. This makes it possible to use the APR -protocol in GraalVM native images. (mgrigorov) +Add GraalVM config for Tomcat JNI related classes. This makes it +possible to use the APR protocol in GraalVM native images. +To use it add the following to the native-image arguments: + -H:JNIConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/tomcat-jni.json +(mgrigorov) JNDIRealm connections should only be created with the container - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch master updated: Don't activate Tomcat's GraalVM JNI resources by default
This is an automated email from the ASF dual-hosted git repository. mgrigorov 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 20edb41 Don't activate Tomcat's GraalVM JNI resources by default 20edb41 is described below commit 20edb410286fdfe141dc0178f361493d4f3ca72c Author: Martin Tzvetanov Grigorov AuthorDate: Wed Nov 11 10:06:31 2020 +0200 Don't activate Tomcat's GraalVM JNI resources by default If an application needs to use APR protocol then it could activate the JNI config by adding '-H:JNIConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/tomcat-jni.json' to native-image's arguments https://bz.apache.org/bugzilla/show_bug.cgi?id=64875 --- res/graal/tomcat-embed-core/native-image/native-image.properties | 2 +- webapps/docs/changelog.xml | 5 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/res/graal/tomcat-embed-core/native-image/native-image.properties b/res/graal/tomcat-embed-core/native-image/native-image.properties index 5cbfb55..8944701 100644 --- a/res/graal/tomcat-embed-core/native-image/native-image.properties +++ b/res/graal/tomcat-embed-core/native-image/native-image.properties @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -Args = -H:ReflectionConfigurationResources=${.}/tomcat-reflection.json -H:ResourceConfigurationResources=${.}/tomcat-resource.json -H:JNIConfigurationResources=${.}/tomcat-jni.json +Args = -H:ReflectionConfigurationResources=${.}/tomcat-reflection.json -H:ResourceConfigurationResources=${.}/tomcat-resource.json diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index c49ff08..a1b224c 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -85,7 +85,10 @@ Add GraalVM config for Tomcat JNI related classes. This makes it -possible to use the APR protocol in GraalVM native images. (mgrigorov) +possible to use the APR protocol in GraalVM native images. +To use it add the following to the native-image arguments: + -H:JNIConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/tomcat-jni.json +(mgrigorov) JNDIRealm connections should only be created with the container - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 64875] ClassNotFoundException with GraalVM and JNI
https://bz.apache.org/bugzilla/show_bug.cgi?id=64875 mgrigorov changed: What|Removed |Added Resolution|--- |FIXED Status|NEEDINFO|RESOLVED --- Comment #11 from mgrigorov --- The auto-activation of Tomcat's GraalVM JNI config is removed with https://github.com/apache/tomcat/commit/20edb410286fdfe141dc0178f361493d4f3ca72c If an application needs to use APR protocol in a native image then it should explicitly activate it by adding '-H:JNIConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/tomcat-jni.json' to native-image's arguments, e.g.: https://github.com/martin-g/http2-server-perf-tests/commit/4fc1cdebd3fd9c75f880fab62ced465b181203de -- 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 52988] ExpandWar::deleteDir() traverses symlinked directories, deleting files outside of appBase
https://bz.apache.org/bugzilla/show_bug.cgi?id=52988 --- Comment #2 from dexter7.42 --- bug present also in Tomcat 8.5.40 -- 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-9-trunk
The Buildbot has detected a new failure on builder tomcat-9-trunk while building tomcat. Full details are available at: https://ci.apache.org/builders/tomcat-9-trunk/builds/540 Buildbot URL: https://ci.apache.org/ Buildslave for this Build: asf946_ubuntu Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-9-commit' triggered this build Build Source Stamp: [branch 9.0.x] 447d24c773dc9bafb7a37bbc583dea5242644065 Blamelist: Martin Tzvetanov Grigorov 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 failure in on tomcat-trunk
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/5549 Buildbot URL: https://ci.apache.org/ Buildslave for this Build: asf946_ubuntu Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' triggered this build Build Source Stamp: [branch master] 20edb410286fdfe141dc0178f361493d4f3ca72c Blamelist: Martin Tzvetanov Grigorov 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
[Bug 64875] ClassNotFoundException with GraalVM and JNI
https://bz.apache.org/bugzilla/show_bug.cgi?id=64875 --- Comment #12 from Iván López --- Thank you very much! -- 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 64872] Inefficient enum resolution in JSPs
https://bz.apache.org/bugzilla/show_bug.cgi?id=64872 --- Comment #7 from Mark Thomas --- That all seems reasonable to me. How big is the patch? Generally, the smaller the patch the fewer the concerns around size of patch vs how widely used the feature is likely to be. -- 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
Re: buildbot failure in on tomcat-trunk
On 11/11/2020 09:11, build...@apache.org wrote: > 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/5549 > > Buildbot URL: https://ci.apache.org/ > > Buildslave for this Build: asf946_ubuntu > > Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' > triggered this build > Build Source Stamp: [branch master] 20edb410286fdfe141dc0178f361493d4f3ca72c > Blamelist: Martin Tzvetanov Grigorov > > BUILD FAILED: failed compile_1 This is the TestWebSocketFrameClient.testConnectToRootEndpoint test again. I've made a little progress with this over the last day or so. What I know so far: - The first WebSocket request is processed - The second is sent to the server (on a new connection) - The acceptor on the server accepts the new connection - The new connection is added to the Selector and a key issued - A short time later the Selector has no keys - The connection is never selected with a valid attachment This suggests a something closing the socket or (less likely) a Selector bug. There appears to be a timing aspect to the failure. Adding and removing debug logging is impacting my ability to recreate the failure. I am able to trigger the issue ~20% of the time on a full NIO test run. I am currently working on trying to recreate the issue more reliably and on shorter test runs. At the moment, it feels like I am making some progress so I plan to keep working on this rather than tagging 10.0.x etc. I don't want to delay the tags too long so my current thinking is keep working on this bug for today and tag tomorrow. Any (lack of) progress may change that view. Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch master updated: Fix Membership thread name
This is an automated email from the ASF dual-hosted git repository. kfujino 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 13721f9 Fix Membership thread name 13721f9 is described below commit 13721f9ebbbd924710230279fbfb8e8f6378cca0 Author: KeiichiFujino AuthorDate: Wed Nov 11 22:18:03 2020 +0900 Fix Membership thread name --- java/org/apache/catalina/tribes/membership/McastServiceImpl.java | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/java/org/apache/catalina/tribes/membership/McastServiceImpl.java b/java/org/apache/catalina/tribes/membership/McastServiceImpl.java index ae95c62..27e4121 100644 --- a/java/org/apache/catalina/tribes/membership/McastServiceImpl.java +++ b/java/org/apache/catalina/tribes/membership/McastServiceImpl.java @@ -373,7 +373,7 @@ public class McastServiceImpl extends MembershipProviderBase { public void run() { String name = Thread.currentThread().getName(); try { - Thread.currentThread().setName("Membership-MemberDisappeared."); + Thread.currentThread().setName("Membership-MemberDisappeared"); service.memberDisappeared(m); }finally { Thread.currentThread().setName(name); @@ -387,7 +387,7 @@ public class McastServiceImpl extends MembershipProviderBase { public void run() { String name = Thread.currentThread().getName(); try { - Thread.currentThread().setName("Membership-MemberAdded."); + Thread.currentThread().setName("Membership-MemberAdded"); service.memberAdded(m); }finally { Thread.currentThread().setName(name); @@ -418,7 +418,7 @@ public class McastServiceImpl extends MembershipProviderBase { public void run() { String name = Thread.currentThread().getName(); try { - Thread.currentThread().setName("Membership-MemberAdded."); + Thread.currentThread().setName("Membership-MemberAdded"); for (ChannelData datum : data) { try { if (datum != null && !member.equals(datum.getAddress())) { @@ -456,7 +456,7 @@ public class McastServiceImpl extends MembershipProviderBase { public void run() { String name = Thread.currentThread().getName(); try { - Thread.currentThread().setName("Membership-MemberExpired."); + Thread.currentThread().setName("Membership-MemberExpired"); service.memberDisappeared(member); } finally { Thread.currentThread().setName(name); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 9.0.x updated: Fix Membership thread name
This is an automated email from the ASF dual-hosted git repository. kfujino pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new 518eb97 Fix Membership thread name 518eb97 is described below commit 518eb97b46f67ab9db6563e4d0e5293eb8f62403 Author: KeiichiFujino AuthorDate: Wed Nov 11 22:23:08 2020 +0900 Fix Membership thread name --- java/org/apache/catalina/tribes/membership/McastServiceImpl.java | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/java/org/apache/catalina/tribes/membership/McastServiceImpl.java b/java/org/apache/catalina/tribes/membership/McastServiceImpl.java index ae95c62..27e4121 100644 --- a/java/org/apache/catalina/tribes/membership/McastServiceImpl.java +++ b/java/org/apache/catalina/tribes/membership/McastServiceImpl.java @@ -373,7 +373,7 @@ public class McastServiceImpl extends MembershipProviderBase { public void run() { String name = Thread.currentThread().getName(); try { - Thread.currentThread().setName("Membership-MemberDisappeared."); + Thread.currentThread().setName("Membership-MemberDisappeared"); service.memberDisappeared(m); }finally { Thread.currentThread().setName(name); @@ -387,7 +387,7 @@ public class McastServiceImpl extends MembershipProviderBase { public void run() { String name = Thread.currentThread().getName(); try { - Thread.currentThread().setName("Membership-MemberAdded."); + Thread.currentThread().setName("Membership-MemberAdded"); service.memberAdded(m); }finally { Thread.currentThread().setName(name); @@ -418,7 +418,7 @@ public class McastServiceImpl extends MembershipProviderBase { public void run() { String name = Thread.currentThread().getName(); try { - Thread.currentThread().setName("Membership-MemberAdded."); + Thread.currentThread().setName("Membership-MemberAdded"); for (ChannelData datum : data) { try { if (datum != null && !member.equals(datum.getAddress())) { @@ -456,7 +456,7 @@ public class McastServiceImpl extends MembershipProviderBase { public void run() { String name = Thread.currentThread().getName(); try { - Thread.currentThread().setName("Membership-MemberExpired."); + Thread.currentThread().setName("Membership-MemberExpired"); service.memberDisappeared(member); } finally { Thread.currentThread().setName(name); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 64872] Inefficient enum resolution in JSPs
https://bz.apache.org/bugzilla/show_bug.cgi?id=64872 --- Comment #8 from John Engebretson --- Our internal patch contained more than one change (the release process was challenging) but separating out this change comes to around 60 lines of code across two files. However, that patch is not up to Tomcat's standards for inclusion (unit tests, a few design considerations, etc.) so for this purpose I consider it "inspiration" rather than something we can directly integrate. And to be clear, I am personally responsible for those deficiencies. :) -- 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 success in on tomcat-trunk
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/5550 Buildbot URL: https://ci.apache.org/ Buildslave for this Build: asf946_ubuntu Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' triggered this build Build Source Stamp: [branch master] 13721f9ebbbd924710230279fbfb8e8f6378cca0 Blamelist: KeiichiFujino Build succeeded! 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-9-trunk
The Buildbot has detected a restored build on builder tomcat-9-trunk while building tomcat. Full details are available at: https://ci.apache.org/builders/tomcat-9-trunk/builds/541 Buildbot URL: https://ci.apache.org/ Buildslave for this Build: asf946_ubuntu Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-9-commit' triggered this build Build Source Stamp: [branch 9.0.x] 518eb97b46f67ab9db6563e4d0e5293eb8f62403 Blamelist: KeiichiFujino 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: Fix NIO concurrency issue that removes connections from the poller.
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 45aeed6 Fix NIO concurrency issue that removes connections from the poller. 45aeed6 is described below commit 45aeed655771308d5185d9dbab8e29a73d87509b Author: Mark Thomas AuthorDate: Wed Nov 11 20:43:04 2020 + Fix NIO concurrency issue that removes connections from the poller. This is the source of the intermittent WebSocket test failure so this commit also removes the associated debug code for that issue. --- java/org/apache/tomcat/util/net/NioEndpoint.java | 40 -- .../tomcat/websocket/TestWebSocketFrameClient.java | 24 +++-- webapps/docs/changelog.xml | 4 +++ 3 files changed, 38 insertions(+), 30 deletions(-) diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java index ac4959e..070a78a 100644 --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -1522,7 +1522,14 @@ public class NioEndpoint extends AbstractJsseEndpoint @Override protected void doRun() { -NioChannel socket = socketWrapper.getSocket(); +/* + * Do not cache and re-use the value of socketWrapper.getSocket() in + * this method. If the socket closes the value will be updated to + * CLOSED_NIO_CHANNEL and the previous value potentially re-used for + * a new connection. That can result in a stale cached value which + * in turn can result in unintentionally closing currently active + * connections. + */ Poller poller = NioEndpoint.this.poller; if (poller == null) { socketWrapper.close(); @@ -1532,7 +1539,7 @@ public class NioEndpoint extends AbstractJsseEndpoint try { int handshake = -1; try { -if (socket.isHandshakeComplete()) { +if (socketWrapper.getSocket().isHandshakeComplete()) { // No TLS handshaking required. Let the handler // process this socket / event combination. handshake = 0; @@ -1542,7 +1549,7 @@ public class NioEndpoint extends AbstractJsseEndpoint // if the handshake failed. handshake = -1; } else { -handshake = socket.handshake(event == SocketEvent.OPEN_READ, event == SocketEvent.OPEN_WRITE); +handshake = socketWrapper.getSocket().handshake(event == SocketEvent.OPEN_READ, event == SocketEvent.OPEN_WRITE); // The handshake process reads/writes from/to the // socket. status may therefore be OPEN_WRITE once // the handshake completes. However, the handshake @@ -1567,27 +1574,23 @@ public class NioEndpoint extends AbstractJsseEndpoint state = getHandler().process(socketWrapper, event); } if (state == SocketState.CLOSED) { -SelectionKey key = JreCompat.isJre11Available() ? null : socket.getIOChannel().keyFor(poller.getSelector()); -poller.cancelledKey(key, socketWrapper); +poller.cancelledKey(getSelectionKey(), socketWrapper); } } else if (handshake == -1 ) { getHandler().process(socketWrapper, SocketEvent.CONNECT_FAIL); -SelectionKey key = JreCompat.isJre11Available() ? null : socket.getIOChannel().keyFor(poller.getSelector()); -poller.cancelledKey(key, socketWrapper); +poller.cancelledKey(getSelectionKey(), socketWrapper); } else if (handshake == SelectionKey.OP_READ){ socketWrapper.registerReadInterest(); } else if (handshake == SelectionKey.OP_WRITE){ socketWrapper.registerWriteInterest(); } } catch (CancelledKeyException cx) { -SelectionKey key = JreCompat.isJre11Available() ? null : socket.getIOChannel().keyFor(poller.getSelector()); -poller.cancelledKey(key, socketWrapper); +poller.cancelledKey(getSelectionKey(), socketWrapper); } catch (VirtualMachineError vme) { ExceptionUtils.handleThrowable(vme); } catch (Throwable t) { log.error(sm.getString("endpoint.processing.fail"), t); -SelectionKey key = JreCompat.isJre11Available() ? null : socket.getIOChannel().keyFor(poller.get
[tomcat] branch 9.0.x updated: Fix NIO concurrency issue that removes connections from the poller.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new ef17d67 Fix NIO concurrency issue that removes connections from the poller. ef17d67 is described below commit ef17d67acb752c843f330a0ee3525bf71f7396b1 Author: Mark Thomas AuthorDate: Wed Nov 11 20:43:04 2020 + Fix NIO concurrency issue that removes connections from the poller. This is the source of the intermittent WebSocket test failure so this commit also removes the associated debug code for that issue. --- java/org/apache/tomcat/util/net/NioEndpoint.java | 31 +- .../tomcat/websocket/TestWebSocketFrameClient.java | 24 - webapps/docs/changelog.xml | 4 +++ 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java index d960d39..97e9f6d 100644 --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -1549,7 +1549,14 @@ public class NioEndpoint extends AbstractJsseEndpoint @Override protected void doRun() { -NioChannel socket = socketWrapper.getSocket(); +/* + * Do not cache and re-use the value of socketWrapper.getSocket() in + * this method. If the socket closes the value will be updated to + * CLOSED_NIO_CHANNEL and the previous value potentially re-used for + * a new connection. That can result in a stale cached value which + * in turn can result in unintentionally closing currently active + * connections. + */ Poller poller = NioEndpoint.this.poller; if (poller == null) { socketWrapper.close(); @@ -1559,7 +1566,7 @@ public class NioEndpoint extends AbstractJsseEndpoint try { int handshake = -1; try { -if (socket.isHandshakeComplete()) { +if (socketWrapper.getSocket().isHandshakeComplete()) { // No TLS handshaking required. Let the handler // process this socket / event combination. handshake = 0; @@ -1569,7 +1576,7 @@ public class NioEndpoint extends AbstractJsseEndpoint // if the handshake failed. handshake = -1; } else { -handshake = socket.handshake(event == SocketEvent.OPEN_READ, event == SocketEvent.OPEN_WRITE); +handshake = socketWrapper.getSocket().handshake(event == SocketEvent.OPEN_READ, event == SocketEvent.OPEN_WRITE); // The handshake process reads/writes from/to the // socket. status may therefore be OPEN_WRITE once // the handshake completes. However, the handshake @@ -1594,23 +1601,23 @@ public class NioEndpoint extends AbstractJsseEndpoint state = getHandler().process(socketWrapper, event); } if (state == SocketState.CLOSED) { - poller.cancelledKey(socket.getIOChannel().keyFor(poller.getSelector()), socketWrapper); +poller.cancelledKey(getSelectionKey(), socketWrapper); } } else if (handshake == -1 ) { getHandler().process(socketWrapper, SocketEvent.CONNECT_FAIL); - poller.cancelledKey(socket.getIOChannel().keyFor(poller.getSelector()), socketWrapper); +poller.cancelledKey(getSelectionKey(), socketWrapper); } else if (handshake == SelectionKey.OP_READ){ socketWrapper.registerReadInterest(); } else if (handshake == SelectionKey.OP_WRITE){ socketWrapper.registerWriteInterest(); } } catch (CancelledKeyException cx) { - poller.cancelledKey(socket.getIOChannel().keyFor(poller.getSelector()), socketWrapper); +poller.cancelledKey(getSelectionKey(), socketWrapper); } catch (VirtualMachineError vme) { ExceptionUtils.handleThrowable(vme); } catch (Throwable t) { log.error(sm.getString("endpoint.processing.fail"), t); - poller.cancelledKey(socket.getIOChannel().keyFor(poller.getSelector()), socketWrapper); +poller.cancelledKey(getSelectionKey(), socketWrapper); } finally { socketWrapper = null; event = null; @@ -1620,8 +1627,18 @@ public class NioEndpoint extends AbstractJsseEndpoint
Re: [tomcat] branch master updated: Fix NIO concurrency issue that removes connections from the poller.
On Wed, Nov 11, 2020 at 9:44 PM 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 45aeed6 Fix NIO concurrency issue that removes connections from > the poller. > 45aeed6 is described below > > commit 45aeed655771308d5185d9dbab8e29a73d87509b > Author: Mark Thomas > AuthorDate: Wed Nov 11 20:43:04 2020 + > > Fix NIO concurrency issue that removes connections from the poller. > > This is the source of the intermittent WebSocket test failure so this > commit also removes the associated debug code for that issue. > Great fix. I never expected this one ... Rémy > --- > java/org/apache/tomcat/util/net/NioEndpoint.java | 40 > -- > .../tomcat/websocket/TestWebSocketFrameClient.java | 24 +++-- > webapps/docs/changelog.xml | 4 +++ > 3 files changed, 38 insertions(+), 30 deletions(-) > > diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java > b/java/org/apache/tomcat/util/net/NioEndpoint.java > index ac4959e..070a78a 100644 > --- a/java/org/apache/tomcat/util/net/NioEndpoint.java > +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java > @@ -1522,7 +1522,14 @@ public class NioEndpoint extends > AbstractJsseEndpoint > > @Override > protected void doRun() { > -NioChannel socket = socketWrapper.getSocket(); > +/* > + * Do not cache and re-use the value of > socketWrapper.getSocket() in > + * this method. If the socket closes the value will be > updated to > + * CLOSED_NIO_CHANNEL and the previous value potentially > re-used for > + * a new connection. That can result in a stale cached value > which > + * in turn can result in unintentionally closing currently > active > + * connections. > + */ > Poller poller = NioEndpoint.this.poller; > if (poller == null) { > socketWrapper.close(); > @@ -1532,7 +1539,7 @@ public class NioEndpoint extends > AbstractJsseEndpoint > try { > int handshake = -1; > try { > -if (socket.isHandshakeComplete()) { > +if (socketWrapper.getSocket().isHandshakeComplete()) { > // No TLS handshaking required. Let the handler > // process this socket / event combination. > handshake = 0; > @@ -1542,7 +1549,7 @@ public class NioEndpoint extends > AbstractJsseEndpoint > // if the handshake failed. > handshake = -1; > } else { > -handshake = socket.handshake(event == > SocketEvent.OPEN_READ, event == SocketEvent.OPEN_WRITE); > +handshake = > socketWrapper.getSocket().handshake(event == SocketEvent.OPEN_READ, event > == SocketEvent.OPEN_WRITE); > // The handshake process reads/writes from/to the > // socket. status may therefore be OPEN_WRITE once > // the handshake completes. However, the handshake > @@ -1567,27 +1574,23 @@ public class NioEndpoint extends > AbstractJsseEndpoint > state = getHandler().process(socketWrapper, > event); > } > if (state == SocketState.CLOSED) { > -SelectionKey key = JreCompat.isJre11Available() ? > null : socket.getIOChannel().keyFor(poller.getSelector()); > -poller.cancelledKey(key, socketWrapper); > +poller.cancelledKey(getSelectionKey(), > socketWrapper); > } > } else if (handshake == -1 ) { > getHandler().process(socketWrapper, > SocketEvent.CONNECT_FAIL); > -SelectionKey key = JreCompat.isJre11Available() ? > null : socket.getIOChannel().keyFor(poller.getSelector()); > -poller.cancelledKey(key, socketWrapper); > +poller.cancelledKey(getSelectionKey(), socketWrapper); > } else if (handshake == SelectionKey.OP_READ){ > socketWrapper.registerReadInterest(); > } else if (handshake == SelectionKey.OP_WRITE){ > socketWrapper.registerWriteInterest(); > } > } catch (CancelledKeyException cx) { > -SelectionKey key = JreCompat.isJre11Available() ? null : > socket.getIOChannel().keyFor(poller.getSelector()); > -poller.cancelledKey(key, socketWrapper); > +poller.cancelledKey(getSelectionKey(), socketWrapper); > } catch (VirtualMachineError vme) {