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 dc442e5 Fix BZ 65311. Correct race condition that could lead to short
delay
dc442e5 is described below
commit dc442e5bab823803ffb92adaa0dc5ed7e83f796f
Author: Mark Thomas <[email protected]>
AuthorDate: Tue May 18 10:56:49 2021 +0100
Fix BZ 65311. Correct race condition that could lead to short delay
https://bz.apache.org/bugzilla/show_bug.cgi?id=65311
---
java/org/apache/tomcat/util/net/NioBlockingSelector.java | 4 +---
webapps/docs/changelog.xml | 5 +++++
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/java/org/apache/tomcat/util/net/NioBlockingSelector.java
b/java/org/apache/tomcat/util/net/NioBlockingSelector.java
index a60b7aa..79f0797 100644
--- a/java/org/apache/tomcat/util/net/NioBlockingSelector.java
+++ b/java/org/apache/tomcat/util/net/NioBlockingSelector.java
@@ -323,11 +323,9 @@ public class NioBlockingSelector {
events();
int keyCount = 0;
try {
- int i = wakeupCounter.get();
- if (i > 0) {
+ if (wakeupCounter.getAndSet(-1) > 0) {
keyCount = selector.selectNow();
} else {
- wakeupCounter.set(-1);
keyCount = selector.select(1000);
}
wakeupCounter.set(0);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 7ded262..2246907 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -119,6 +119,11 @@
an error occurs on an HTTP/1.1 connection being upgraded to HTTP/2 or
on
a pushed HTTP/2 stream. (markt)
</fix>
+ <fix>
+ <bug>65311</bug>: Fix a race condition in the
+ <code>NioBlockingSelector</code> that could cause a delay to select
+ operations. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]