Bug 130028 - NPE in HttpListener
Summary: NPE in HttpListener
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Compendium (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 RC2   Edit
Assignee: Jennifer Fogell CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2006-03-01 15:46 EST by Paul VanderLei CLA
Modified: 2006-08-23 15:20 EDT (History)
3 users (show)

See Also:


Attachments
httplistener patch (1.13 KB, patch)
2006-03-24 13:17 EST, Simon Kaegi CLA
no flags Details | Diff
proposed fix for 130028 and 130443 (152.35 KB, patch)
2006-04-18 14:07 EDT, Jennifer Fogell CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul VanderLei CLA 2006-03-01 15:46:37 EST
On line 201 of HttpListener, is this code:
	HttpThread thread = configuration.pool.getThread();

I get an intermittent NPE from this, especially when I try to run in debug mode. This makes me suspect some sort of (gasp!) start level dependency problem. Anyone seen anything like this or have a clue how to work around it?

org.eclipse.equinox.http (1.0.0.v20060206)
Comment 1 Jennifer Fogell CLA 2006-03-01 15:59:04 EST
Paul, can you cut and paste your exception to this bug?
Comment 2 Paul VanderLei CLA 2006-03-01 16:03:08 EST
Here is the stack trace. This is as deep as it goes.

Exception in thread "Thread-1" java.lang.NullPointerException
	at org.eclipse.equinox.http.HttpListener.run(HttpListener.java:201)
Comment 3 Simon Kaegi CLA 2006-03-24 13:17:52 EST
Created attachment 36902 [details]
httplistener patch

Just some ideas...
There's possibility for trouble during start and stop of the HttpConfiguration.

In initialize() there's a comment...
/* Create configured listeners before thread pool
 * in case we exceed the number of threads */

I think we _have to_ initialize the thread pool before-hand because the listener will try to use the pool if it get's a request. Even if there are more listeners than threads it's not optimal but also not catastrophic as the listener will just block until a thread is available.

In close() we shouldn't explicitly set the pool=null (just helps GC) as a listener may still be live. In this case the pool.getThread() will return null which is handled in the listener.
Comment 4 Thomas Watson CLA 2006-04-09 17:07:58 EDT
Jennifer, any progress here?  Please investigate for 3.2.
Comment 5 Jennifer Fogell CLA 2006-04-18 14:07:43 EDT
Created attachment 38827 [details]
proposed fix for 130028 and 130443

The proposed patch also includes fixes for HttpService build warnings (see bug #130443).
Comment 6 Simon Kaegi CLA 2006-04-18 15:15:41 EDT
Hi Jennifer,

Would you mind if we did this in two separate pieces. It's hard for me to see what's changed for this particular fix. Is it just my patch?

Also, I think your global "org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess" setting is over-riding the project's settings.

I've had it in my local workspace for ages, so I'll submit an updated "warning cleanup" patch in bug 130443 that cleans according to the project settings.
Comment 7 Jennifer Fogell CLA 2006-04-18 19:01:36 EDT
ok, fair enough, I've applied Simon's patch and will apply the warnings fixup patch separately.

[contributed patch applied]
Comment 8 Thomas Watson CLA 2006-08-23 15:20:30 EDT
adding "contributed" keyword to patches contributed by the community.