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 b42b6fe Fix BZ 65311. Correct race condition that could lead to short
delay
b42b6fe is described below
commit b42b6fedefea8f1a8f26bc006e8aeee6497c7411
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 | 6 ++----
webapps/docs/changelog.xml | 5 +++++
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/java/org/apache/tomcat/util/net/NioBlockingSelector.java
b/java/org/apache/tomcat/util/net/NioBlockingSelector.java
index 5aaa90e..4b61440 100644
--- a/java/org/apache/tomcat/util/net/NioBlockingSelector.java
+++ b/java/org/apache/tomcat/util/net/NioBlockingSelector.java
@@ -320,11 +320,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);
+ } else {
keyCount = selector.select(1000);
}
wakeupCounter.set(0);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index c9b3a5c..1922cfe 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]