You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2016/04/13 20:48:35 UTC
svn commit: r1738982 - in /tomcat/trunk:
java/org/apache/tomcat/util/net/NioEndpoint.java webapps/docs/changelog.xml
Author: markt
Date: Wed Apr 13 18:48:35 2016
New Revision: 1738982
URL: http://svn.apache.org/viewvc?rev=1738982&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=58970
Fix a connection counting bug in the NIO connector that meant some dropped connections were not removed from the current connection count.
Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
tomcat/trunk/webapps/docs/changelog.xml
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1738982&r1=1738981&r2=1738982&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Wed Apr 13 18:48:35 2016
@@ -625,8 +625,14 @@ public class NioEndpoint extends Abstrac
} else {
final SelectionKey key = socket.getIOChannel().keyFor(socket.getPoller().getSelector());
try {
- boolean cancel = false;
- if (key != null) {
+ if (key == null) {
+ // The key was cancelled (e.g. due to socket closure)
+ // and removed from the selector while it was being
+ // processed. Count down the connections at this point
+ // since it won't have been counted down when the socket
+ // closed.
+ socket.socketWrapper.getEndpoint().countDownConnection();
+ } else {
final NioSocketWrapper socketWrapper = (NioSocketWrapper) key.attachment();
if (socketWrapper != null) {
//we are registering the key to start with, reset the fairness counter.
@@ -634,12 +640,9 @@ public class NioEndpoint extends Abstrac
socketWrapper.interestOps(ops);
key.interestOps(ops);
} else {
- cancel = true;
+ socket.getPoller().cancelledKey(key);
}
- } else {
- cancel = true;
}
- if (cancel) socket.getPoller().cancelledKey(key);
} catch (CancelledKeyException ckx) {
try {
socket.getPoller().cancelledKey(key);
Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1738982&r1=1738981&r2=1738982&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Wed Apr 13 18:48:35 2016
@@ -53,6 +53,11 @@
provided by Ondrej Medek. (markt)
</fix>
<fix>
+ <bug>58970</bug>: Fix a connection counting bug in the NIO connector
+ that meant some dropped connections were not removed from the current
+ connection count. (markt)
+ </fix>
+ <fix>
<bug>59206</bug>: Ensure NPE will not be thrown by
<code>o.a.tomcat.util.file.ConfigFileLoader</code> when
<code>catalina.base</code> is not specified. (violetagg)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org