You are correct, I was chasing down the following:
Testsuite: org.apache.catalina.websocket.TestWebSocket
Tests run: 6, Failures: 1, Errors: 0, Time elapsed: 2.048 sec
....
INFO: Starting ProtocolHandler ["http-nio-127.0.0.1-auto-2-9027"]
Jul 12, 2012 11:56:27 AM
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler process
SEVERE: null
java.lang.IllegalArgumentException: Negative timeout
at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
at
org.apache.tomcat.util.net.NioSelectorPool.read(NioSelectorPool.java:267)
at
org.apache.tomcat.util.net.NioSelectorPool.read(NioSelectorPool.java:227)
at
org.apache.coyote.http11.upgrade.UpgradeNioProcessor.readSocket(UpgradeNioProcessor.java:139)
at
org.apache.coyote.http11.upgrade.UpgradeNioProcessor.read(UpgradeNioProcessor.java:112)
at org.apache.catalina.websocket.WsFrame.nextFrame(WsFrame.java:213)
at
org.apache.catalina.websocket.WsInputStream.nextFrame(WsInputStream.java:68)
at
org.apache.catalina.websocket.StreamInbound.onData(StreamInbound.java:117)
at
org.apache.coyote.http11.upgrade.UpgradeProcessor.upgradeDispatch(UpgradeProcessor.java:83)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:583)
at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1676)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
We should not use -1 in our unit tests. I'm tempted to get rid of the -1 notion
all together, no sane person should ever use no timeout :)
> -----Original Message-----
> From: Mark Thomas [mailto:[email protected]]
> Sent: Thursday, July 12, 2012 2:20 PM
> To: Tomcat Developers List
> Subject: Re: svn commit: r1360905 -
> /tomcat/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java
>
> On 12/07/2012 21:11, [email protected] wrote:
> > Author: fhanik
> > Date: Thu Jul 12 20:11:31 2012
> > New Revision: 1360905
> >
> > URL: http://svn.apache.org/viewvc?rev=1360905&view=rev
> > Log:
> > Correct handling of timeout - negative or zero means no timeout but an
> instant
>
> Nope. The expected and documented behaviour for a negative timeout for
> all connectors is an infinite timeout.
>
> Mark
>
> >
> >
> > Modified:
> > tomcat/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java
> >
> > Modified:
> tomcat/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java
> > URL:
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/ne
> t/NioSelectorPool.java?rev=1360905&r1=1360904&r2=1360905&view=diff
> >
> ========================================================================
> ======
> > --- tomcat/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java
> (original)
> > +++ tomcat/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java
> Thu Jul 12 20:11:31 2012
> > @@ -196,7 +196,11 @@ public class NioSelectorPool {
> > //register OP_WRITE to the selector
> > if (key==null) key =
> socket.getIOChannel().register(selector, SelectionKey.OP_WRITE);
> > else key.interestOps(SelectionKey.OP_WRITE);
> > - keycount = selector.select(writeTimeout);
> > + if (writeTimeout<=0) {
> > + keycount = selector.selectNow();
> > + } else {
> > + keycount = selector.select(writeTimeout);
> > + }
> > }
> > if (writeTimeout > 0 && (selector == null || keycount
> == 0) ) timedout = (System.currentTimeMillis()-time)>=writeTimeout;
> > }//while
> > @@ -264,7 +268,11 @@ public class NioSelectorPool {
> > //register OP_WRITE to the selector
> > if (key==null) key =
> socket.getIOChannel().register(selector, SelectionKey.OP_READ);
> > else key.interestOps(SelectionKey.OP_READ);
> > - keycount = selector.select(readTimeout);
> > + if (readTimeout<=0) {
> > + keycount = selector.selectNow();
> > + } else {
> > + keycount = selector.select(readTimeout);
> > + }
> > }
> > if (readTimeout > 0 && (selector == null || keycount
> == 0) ) timedout = (System.currentTimeMillis()-time)>=readTimeout;
> > }//while
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]