Hi,
My Tomcat 6.0.18 throws NPEs if there are incoming connections to an NIO
connector before the connector had a chance to initialize. The behavior
that I would expect is for Tomcat to simply refuse incoming connections
until the connector is ready.
I found a similar post on this mailing list
(http://mail-archives.apache.org/mod_mbox/tomcat-users/200802.mbox/%3c47a5f469.40...@apache.org%3e),
which links to Bug 43701
(https://issues.apache.org/bugzilla/show_bug.cgi?id=43701). The bug
report describes the behavior that I'm seeing with 6.0.18, but says that
it's fixed in 6.0.15 onwards. Is it back? Below is my config and how I
reproduce the problem. Exceptions are the same as in the bug report
above, but with different line numbers. Thanks in advance for your
help.
Tomcat version info (from running version.bat)
-----------------------------------------------
Server version: Apache Tomcat/6.0.18
Server built: Jul 22 2008 02:00:36
Server number: 6.0.18.0
OS Name: Windows 2003
OS Version: 5.2
Architecture: x86
JVM Version: 1.5.0_05-b05
JVM Vendor: Sun Microsystems Inc.
Steps to reproduce
--------------------
1. Add an NIO connector to server.xml, like this
<Connector port="8081"
protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150"
connectionTimeout="20000" acceptorThreadCount="1"
redirectPort="8444" socket.directBuffer="false"/>
2. Open browser and point it to http://localhost:8081/. It's easier to
reproduce with Firefox for some reason.
3. Start Tomcat by double-clicking startup.bat
4. As Tomcat is starting, keep refreshing the browser by quickly
clicking the refresh button as fast as you can. It may not work the
first time.
You should see some NullPointerExceptions in Tomcat log, like this:
Oct 28, 2008 11:10:22 AM org.apache.tomcat.util.net.NioEndpoint
setSocketOptions
SEVERE:
java.lang.NullPointerException
at
org.apache.tomcat.util.net.NioEndpoint.setSocketOptions(NioEndpoint.java:1011)
at
org.apache.tomcat.util.net.NioEndpoint$Acceptor.run(NioEndpoint.java:1204)
at java.lang.Thread.run(Unknown Source)
Oct 28, 2008 11:10:22 AM org.apache.tomcat.util.net.NioEndpoint
setSocketOptions
SEVERE:
java.lang.NullPointerException
at
org.apache.tomcat.util.net.NioEndpoint.setSocketOptions(NioEndpoint.java:1011)
at
org.apache.tomcat.util.net.NioEndpoint$Acceptor.run(NioEndpoint.java:1204)
at java.lang.Thread.run(Unknown Source)
Oct 28, 2008 11:10:22 AM org.apache.coyote.http11.Http11NioProtocol
start
INFO: Starting Coyote HTTP/1.1 on http-8080
Oct 28, 2008 11:10:22 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 831 ms