Author: markt Date: Wed Apr 23 21:11:20 2014 New Revision: 1589521 URL: http://svn.apache.org/r1589521 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56348 Fix slow async reads on non-container thread. Align code with APR. Ensure that selector is woken up when a socket is registered for a new event
Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java?rev=1589521&r1=1589520&r2=1589521&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java Wed Apr 23 21:11:20 2014 @@ -155,20 +155,15 @@ public class Http11NioProcessor extends @Override protected void registerForEvent(boolean read, boolean write) { final NioChannel socket = socketWrapper.getSocket(); - final NioEndpoint.KeyAttachment attach = - (NioEndpoint.KeyAttachment) socket.getAttachment(false); - if (attach == null) { - return; - } - SelectionKey key = socket.getIOChannel().keyFor(socket.getPoller().getSelector()); + + int interestOps = 0; if (read) { - attach.interestOps(attach.interestOps() | SelectionKey.OP_READ); - key.interestOps(key.interestOps() | SelectionKey.OP_READ); + interestOps = SelectionKey.OP_READ; } if (write) { - attach.interestOps(attach.interestOps() | SelectionKey.OP_WRITE); - key.interestOps(key.interestOps() | SelectionKey.OP_WRITE); + interestOps = interestOps | SelectionKey.OP_WRITE; } + socket.getPoller().add(socket, interestOps); } Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1589521&r1=1589520&r2=1589521&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Wed Apr 23 21:11:20 2014 @@ -149,6 +149,10 @@ <scode> Fix code duplication between NIO and NIO2. (remm) </scode> + <fix> + <bug>56348</bug>: Fix slow asynchronous read when read was performed on + a non-container thread. (markt) + </fix> </changelog> </subsection> <subsection name="Jasper"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org