Community
Participate
Working Groups
Build Identifier: java.lang.NullPointerException: null at org.eclipse.jetty.io.BufferUtil.putHexInt(BufferUtil.java:132) ~[na:na] at org.eclipse.jetty.http.HttpGenerator.prepareBuffers(HttpGenerator.java:996) ~[na:na] at org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:826) ~[na:na] at org.eclipse.jetty.http.AbstractGenerator.flush(AbstractGenerator.java:452) ~[na:na] at org.eclipse.jetty.server.HttpOutput.flush(HttpOutput.java:94) ~[na:na] at org.eclipse.jetty.server.HttpConnection$Output.flush(HttpConnection.java:1015) ~[na:na] at com.sun.jersey.spi.container.servlet.WebComponent$Writer.flush(WebComponent.java:318) ~[jersey-server-1.5.jar:1.5] at com.sun.jersey.spi.container.ContainerResponse$CommittingOutputStream.flush(ContainerResponse.java:145) ~[jersey-server-1.5.jar:1.5] at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:278) ~[na:1.6.0_26] at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:122) ~[na:1.6.0_26] at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:212) ~[na:1.6.0_26] at java.io.BufferedWriter.flush(BufferedWriter.java:236) ~[na:1.6.0_26] at com.sun.jersey.core.util.ReaderWriter.writeToAsString(ReaderWriter.java:191) ~[jersey-core-1.5.jar:1.5] at com.sun.jersey.core.provider.AbstractMessageReaderWriterProvider.writeToAsString(AbstractMessageReaderWriterProvider.java:128) ~[jersey-core-1.5.jar:1.5] at com.sun.jersey.core.impl.provider.entity.StringProvider.writeTo(StringProvider.java:88) ~[jersey-core-1.5.jar:1.5] at com.sun.jersey.core.impl.provider.entity.StringProvider.writeTo(StringProvider.java:58) ~[jersey-core-1.5.jar:1.5] at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:306) ~[jersey-server-1.5.jar:1.5] at org.atmosphere.jersey.util.JerseyBroadcasterUtil.broadcast(JerseyBroadcasterUtil.java:73) ~[atmosphere-jersey-0.9-SNAPSHOT.jar:0.9-SNAPSHOT] at org.atmosphere.jersey.JerseyBroadcaster.broadcast(JerseyBroadcaster.java:58) [atmosphere-jersey-0.9-SNAPSHOT.jar:0.9-SNAPSHOT] at org.atmosphere.cpr.DefaultBroadcaster.executeAsyncWrite(DefaultBroadcaster.java:596) [atmosphere-runtime-0.9-SNAPSHOT.jar:0.9-SNAPSHOT] at org.atmosphere.cpr.DefaultBroadcaster$3.run(DefaultBroadcaster.java:621) [atmosphere-runtime-0.9-SNAPSHOT.jar:0.9-SNAPSHOT] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [na:1.6.0_26] at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [na:1.6.0_26] at java.util.concurrent.FutureTask.run(FutureTask.java:138) [na:1.6.0_26] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_26] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_26] at java.lang.Thread.run(Thread.java:680) [na:1.6.0_26] Reproducible: Always Steps to Reproduce: 1. deploy the attached war 2. curl -N http://127.0.0.1:8080/atmosphere-test-1.0/1/stream 3. the NPE will be displayed. This issue doesn't occur with 8.0.1 and lower
I wasn't able to attach the test case so here is a new one. Observation: I'm also seeing some exception when suspending a Request and writing to it later. The issue seems to be that the Request is recycled event if there is a Continuation associated with it. To reproduce the issue, download https://oss.sonatype.org/content/repositories/snapshots/org/atmosphere/samples/atmosphere-jquery-pubsub/0.9-SNAPSHOT/atmosphere-jquery-pubsub-0.9-20111028.193044-9.war deploy and do : (1) http://localhost:8080/atmosphere-jquery-pubsub/ (2) Enter a topic, select http-streaming for transport (3) Enter a value Note that this sample works as it is with 8.0.1, but I do see the issue with 8.0.2 and up Ping me on the Jetty's irc for more info
Found a workaround (quite ugly but works) ...7.5.4 and 8.0.2 and up now works. https://github.com/Atmosphere/atmosphere/commit/4f6f31e0b82200c5d887ddd69e408a7e8591841b It seems that if I output the following https://gist.github.com/1331709 (the Atmosphere's padding data for http-streaming), as soon as I try to write again, the exception occurs. The steps to reproduce are: (1) Thread 1 -> write the padding (2) Thread 1 -> Continuation.suspend() (3) Thread 2 -> try to write something The exception always occurs in (3) and after the connection is broken. I wonder if the response's buffer gets committed because of the padding and the request recycled (it sound it gets recycled).
Hi Jeanfrancois, The link to the war file unfortunately no longer exists on the sonatype repo, and I'm assuming the war files that are there now have your workaround in them, as they work for jetty-8.0.4. Do you have the previous war file around somewhere that you could attach to the issue, or email me separately (janb at intalio.com)? thanks Jan
Also, how is the output being generated? Are you using Continuation.suspend() and Continuation.resume() methods, or are you using Servlet 3 AsyncContext, and are you writing output whilst suspended? thanks Jan
Created attachment 206646 [details] Small test harness. Jeanfrancois, This is a small test harness class I've been toying with trying to reproduce your situation, based on trying to follow through the atmosphere code on github. Can you modify this so that it accurately reflects the situation where you get the error? I haven't been able to get this code to fail with jetty-8.0.5-SNAPSHOT, but that may be because I'm not reproducing your situation ... thanks Jan
(In reply to comment #3) > Hi Jeanfrancois, > > The link to the war file unfortunately no longer exists on the sonatype repo, > and I'm assuming the war files that are there now have your workaround in them, > as they work for jetty-8.0.4. > > Do you have the previous war file around somewhere that you could attach to the > issue, or email me separately (janb at intalio.com)? > > thanks > Jan Jan, oups I will work on sample that fail. I do use Continuation#suspend and #complete: https://github.com/Atmosphere/atmosphere/blob/master/modules/cpr/src/main/java/org/atmosphere/container/Jetty7CometSupport.java#L76 I've added many workaround to fix regressions occurred starting with 8.0.2 and up (Request gets recycled after the handshake so I can't use that object anymore because it case NPE, No Session Manager found etc.). Is there a reason why Request is recycled so early? Thanks!!! -- Jeanfrancois
OK download the jar here https://github.com/Atmosphere/Incubator/blob/master/atmosphere-jquery-pubsub.war Deploy in 8.0.4 (1) Enter a topic (2) Select streamin for transport (3) Connect (4) enter a message 15:28:29.998 [Atmosphere-AsyncWrite-0] DEBUG o.a.j.util.JerseyBroadcasterUtil - onException() java.lang.NullPointerException: null at org.eclipse.jetty.io.BufferUtil.putHexInt(BufferUtil.java:149) ~[na:na] at org.eclipse.jetty.http.HttpGenerator.prepareBuffers(HttpGenerator.java:996) ~[na:na] at org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:826) ~[na:na] at org.eclipse.jetty.http.AbstractGenerator.flush(AbstractGenerator.java:452) ~[na:na] at org.eclipse.jetty.server.HttpOutput.flush(HttpOutput.java:94) ~[na:na] at org.eclipse.jetty.server.HttpConnection$Output.flush(HttpConnection.java:1015) ~[na:na]
Fixed for jetty-7.5.5 and jetty-8.0.5.