Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 362614

Summary: NPE in accepting connection
Product: [RT] Jetty Reporter: Jan Bartel <janb>
Component: serverAssignee: Jan Bartel <janb>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: cowwoc2020, jetty-inbox, qquit27
Version: 7.5.4   
Target Milestone: 7.5.x   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Jan Bartel CLA 2011-11-01 21:01:11 EDT
Line 162 of SelectorManager can throw a NullPointerException iff:

* the Connectors are opened before Server.start() (eg in order to open as root before using setuid to change down to a lower privileged user)

* a request arrives before the SelectorManager has completed its its start() sequence. In this case, the SelectorSet[] array is allocated, but empty.
Comment 1 Jan Bartel CLA 2011-11-01 21:03:41 EDT
Resolved for 7.5.5.
Comment 2 Jan Bartel CLA 2011-11-17 22:15:30 EST
*** Bug 364033 has been marked as a duplicate of this bug. ***
Comment 3 Jan Bartel CLA 2011-11-21 18:47:35 EST
Just for completeness' sake, for those finding this issue, I got the line number wrong in the original comment. The problem actually occurs at line 158:

java.lang.NullPointerException
        at org.eclipse.jetty.io.nio.SelectorManager.register(SelectorManager.java:158)
        at org.eclipse.jetty.server.nio.SelectChannelConnector.accept(SelectChannelConnector.java:101)
        at org.eclipse.jetty.server.AbstractConnector$Acceptor.run(AbstractConnector.java:833)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533)
        at java.lang.Thread.run(Thread.java:680)
Comment 4 Jan Bartel CLA 2011-11-21 18:49:59 EST
*** Bug 364372 has been marked as a duplicate of this bug. ***