Bug 53075 - [websocket] Sporadic NPE in InternalOutputBuffer
Summary: [websocket] Sporadic NPE in InternalOutputBuffer
Status: RESOLVED INVALID
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: trunk
Hardware: PC Mac OS X 10.4
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-13 13:46 UTC by Jean-Francois Arcand
Modified: 2012-05-25 21:27 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Francois Arcand 2012-04-13 13:46:55 UTC
The following exception sporadically occurs with WebSocket

2012-04-13 09:43:54,919 DEBUG [Atmosphere-AsyncWrite-0] - o.atmosphere.cpr.DefaultBroadcaster : onException()
java.lang.NullPointerException: null
	at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:215) ~[tomcat-coyote.jar:7.0.27]
	at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:462) ~[tomcat-coyote.jar:7.0.27]
	at org.apache.coyote.http11.InternalOutputBuffer.flush(InternalOutputBuffer.java:119) ~[tomcat-coyote.jar:7.0.27]
	at org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:789) ~[tomcat-coyote.jar:7.0.27]
	at org.apache.coyote.Response.action(Response.java:174) ~[tomcat-coyote.jar:7.0.27]
	at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:341) ~[catalina.jar:7.0.27]
	at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:306) ~[catalina.jar:7.0.27]
	at org.apache.catalina.connector.CoyoteWriter.flush(CoyoteWriter.java:98) ~[catalina.jar:7.0.27]
	at org.atmosphere.handler.AbstractReflectorAtmosphereHandler.onStateChange(AbstractReflectorAtmosphereHandler.java:130) ~[atmosphere-runtime-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
	at org.atmosphere.cpr.DefaultBroadcaster.broadcast(DefaultBroadcaster.java:816) [atmosphere-runtime-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
	at org.atmosphere.cpr.DefaultBroadcaster.executeAsyncWrite(DefaultBroadcaster.java:731) [atmosphere-runtime-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
	at org.atmosphere.cpr.DefaultBroadcaster$3.run(DefaultBroadcaster.java:764) [atmosphere-runtime-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [na:1.6.0_29]
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [na:1.6.0_29]
	at java.util.concurrent.FutureTask.run(FutureTask.java:138) [na:1.6.0_29]
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_29]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_29]
	at java.lang.Thread.run(Thread.java:680) [na:1.6.0_29]
Comment 1 Mark Thomas 2012-05-25 21:27:23 UTC
Looking at the stack trace, something is writing to the Writer obtained via ServletResposne.getWriter() but since this bug relates to WebSocket, nothing should be writing via the ServletResponse object. It appears that a reference to the Writer is being retained and used when it should not be.

I have zero knowledge of the Atmosphere framework so it is always possible I am mis-reading what is going on in the context of that framework. Feel free to re-open this issue with further clarification on the circumstances if I have.