Bug 43701 - Error while starting tomcat
Summary: Error while starting tomcat
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Connectors (show other bugs)
Version: 6.0.14
Hardware: Other Windows XP
: P1 critical (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-26 03:01 UTC by prabhat
Modified: 2008-04-13 15:21 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description prabhat 2007-10-26 03:01:21 UTC
this is my NIO Connector configuration in server.xml 
<Connector acceptCount="100" enableLookups="false" port="80"
protocol="org.apache.coyote.http11.Http11NioProtocol" 
      acceptorThreadCount="2" socket.bufferPool="-1" connectionTimeout="60000"
maxKeepAliveRequests="-1" maxThreads="200"
      minSpareThreads="25" redirectPort="8443" />

when I am starting my tomcat it is giving following error in the console several
time 
SEVERE: 
java.lang.NullPointerException
	at org.apache.tomcat.util.net.NioEndpoint.setSocketOptions(NioEndpoint.java:985)
	at org.apache.tomcat.util.net.NioEndpoint$Acceptor.run(NioEndpoint.java:1169)
	at java.lang.Thread.run(Thread.java:595)
Comment 1 prabhat 2007-10-26 03:47:05 UTC
One more important thing I missed out .
The condition when this bug is comming is if there is any preexisting connection
which is trying to connect to the server but server is down and when I start it
again it will give this error.
Comment 2 Pavel Zuev 2007-10-30 14:22:41 UTC
I've stumbled upon this bug too.
Looks like it is being caused by the race condition between the main thread and 
the newly created acceptor thread. I'm getting this error quite often on my 
Core 2 Duo/WinXP 32-bit/Java 6u02.

I think that's what happens here:
1) Acceptor thread is started at NioEndpoint:792;
2) Main thread allocates the pollers array (initially filled with nulls) at 
NioEndpoint:796;
3) Acceptor thread immediately catches an incoming connection and accesses the 
still uninitialized pollers array (inside the setSocketOptions method called at 
NioEndpoint:1169).

Seems that poller threads should be created before starting acceptors; also, 
poller-related fields shall be marked volatile.
Comment 3 Pavel Zuev 2007-10-30 14:29:38 UTC
Http11AprProtocol has the same bug.
Comment 4 Mark Thomas 2008-04-13 15:21:02 UTC
Filip fixed this for 6.0.15 onwards. APR was fixed even earlier.