GlassfishV2CometSupport doesn't work

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

GlassfishV2CometSupport doesn't work

Florian Hars-3
After tearing my hair out for almost a day I had the idea to check with
the original atmosphere-chat.war and found that the weird behavior I was
fighting with is indeed not related to my code.

I put the war into the autodeploy directory of the sailfin I happend to
have on my laptop, and connected to the server with

$ nc localhost 8080
GET /atmosphere-chat/ChatAtmosphereHandler HTTP/1.1
Host: localhost

HTTP/1.1 200 OK
X-Powered-By: Servlet/2.5
Server: Sun GlassFish Communications Server 1.5
Set-Cookie: JSESSIONID=c0c99b61279472b7407ae6660ed9; Path=/atmosphere-chat
Cache-Control: private
Pragma: no-cache
Content-Type: text/html;charset=ISO-8859-1
Transfer-Encoding: chunked
Date: Thu, 04 Jun 2009 16:14:15 GMT

94
<!-- Comet is a programming technique that enables web servers to send
data to the client without having any need for the client to request it. -->

0

No surprise here. Then I opened the app in a browser, logged in and sent
some messages. Nothing ever appeared in the chat area of the browser
window, and nothing happened in the nc session.

Then I aborted the nc session and started a few new ones. The next one
still looked ok:

$ nc localhost 8080
GET /atmosphere-chat/ChatAtmosphereHandler HTTP/1.1
Host: localhost

HTTP/1.1 200 OK
X-Powered-By: Servlet/2.5
Server: Sun GlassFish Communications Server 1.5
Set-Cookie: JSESSIONID=c0d9be41139f1b7e224e5b947bab; Path=/atmosphere-chat
Cache-Control: private
Pragma: no-cache
Content-Type: text/html;charset=ISO-8859-1
Transfer-Encoding: chunked
Date: Thu, 04 Jun 2009 16:15:21 GMT

94
<!-- Comet is a programming technique that enables web servers to send
data to the client without having any need for the client to request it. -->

0

^C

But the third one is fishy:
$ nc localhost 8080
GET /atmosphere-chat/ChatAtmosphereHandler HTTP/1.1
Host: localhost

HTTP/1.1 200 OK
Content-Type: text/html; charset=iso-8859-1
Transfer-Encoding: chunked
Date: Thu, 04 Jun 2009 16:15:03 GMT

69
<script type='text/javascript'>
window.parent.app.update({ name: "Florian", message: "bla" });
</script>

69
<script type='text/javascript'>
window.parent.app.update({ name: "Florian", message: "bla" });
</script>

69
<script type='text/javascript'>
window.parent.app.update({ name: "Florian", message: "bla" });
</script>

0

It lacks the headers set by the AtmosphereHandler, the Date corresponds
to one of the POST requests from the browser, not my current request,
and it contains some of the messages that went missing earlier during
the experiment.

The log file contains something like correlates with a POST request.

[#|2009-06-04T18:15:25.870+0200|SEVERE|sun-glassfish-comms-server1.5|javax.enterprise.system.container.web|_ThreadID=15;_ThreadName=httpWorkerThread-8080-1;_RequestID=62f8d3f9-7dcf-415f-beee-7b5a79d86a73;|StandardWrapperValve[Atmosphere
Chat]: PWC1406: Servlet.service() for servlet Atmosphere Chat threw
exception
java.lang.IllegalStateException: PWC3999: Cannot create a session after
the response has been committed
        at
org.apache.coyote.tomcat5.CoyoteRequest.doGetSession(CoyoteRequest.java:2847)
        at
org.apache.coyote.tomcat5.CoyoteRequest.getSession(CoyoteRequest.java:2609)
        at
org.apache.coyote.tomcat5.CoyoteRequestFacade.getSession(CoyoteRequestFacade.java:912)
        at
org.apache.coyote.tomcat5.CoyoteRequestFacade.getSession(CoyoteRequestFacade.java:923)
        at
org.atmosphere.container.GlassFishv2CometSupport.service(GlassFishv2CometSupport.java:114)
        at org.atmosphere.cpr.AtmosphereServlet.service(AtmosphereServlet.java:310)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

With my handler, I could post as many messages while no event had ever
been suspended. after one event was suspended, I could post four
messages without getting a strange result. If I posted a fifth message,
the above exception was thrown, and the result ot the post was not the
text "success", but the text of the four messages. Then I cound post
four new messages before getting the same error and so on. If more
events had been suspended, the behaviour changed. This may or may not be
related to the fact that the server is configured to use up to five
threads to process requests.

The most specific version information I could find was:
Sun GlassFish Communications Server 1.5 (9.1.1) (build b60g-fcs)

- Florian.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: GlassfishV2CometSupport doesn't work

Jeanfrancois Arcand
Salut,

quck question before I look at it. Did you enable Comet? See inline

Florian Hars wrote:

> After tearing my hair out for almost a day I had the idea to check with
> the original atmosphere-chat.war and found that the weird behavior I was
> fighting with is indeed not related to my code.
>
> I put the war into the autodeploy directory of the sailfin I happend to
> have on my laptop, and connected to the server with
>
> $ nc localhost 8080
> GET /atmosphere-chat/ChatAtmosphereHandler HTTP/1.1
> Host: localhost
>
> HTTP/1.1 200 OK
> X-Powered-By: Servlet/2.5
> Server: Sun GlassFish Communications Server 1.5
> Set-Cookie: JSESSIONID=c0c99b61279472b7407ae6660ed9; Path=/atmosphere-chat
> Cache-Control: private
> Pragma: no-cache
> Content-Type: text/html;charset=ISO-8859-1
> Transfer-Encoding: chunked
> Date: Thu, 04 Jun 2009 16:14:15 GMT
>
> 94
> <!-- Comet is a programming technique that enables web servers to send
> data to the client without having any need for the client to request it.
> -->
>
> 0
>
> No surprise here. Then I opened the app in a browser, logged in and sent
> some messages. Nothing ever appeared in the chat area of the browser
> window, and nothing happened in the nc session.
>
> Then I aborted the nc session and started a few new ones. The next one
> still looked ok:
>
> $ nc localhost 8080
> GET /atmosphere-chat/ChatAtmosphereHandler HTTP/1.1
> Host: localhost
>
> HTTP/1.1 200 OK
> X-Powered-By: Servlet/2.5
> Server: Sun GlassFish Communications Server 1.5
> Set-Cookie: JSESSIONID=c0d9be41139f1b7e224e5b947bab; Path=/atmosphere-chat
> Cache-Control: private
> Pragma: no-cache
> Content-Type: text/html;charset=ISO-8859-1
> Transfer-Encoding: chunked
> Date: Thu, 04 Jun 2009 16:15:21 GMT
>
> 94
> <!-- Comet is a programming technique that enables web servers to send
> data to the client without having any need for the client to request it.
> -->
>
> 0
>
> ^C
>
> But the third one is fishy:
> $ nc localhost 8080
> GET /atmosphere-chat/ChatAtmosphereHandler HTTP/1.1
> Host: localhost
>
> HTTP/1.1 200 OK
> Content-Type: text/html; charset=iso-8859-1
> Transfer-Encoding: chunked
> Date: Thu, 04 Jun 2009 16:15:03 GMT
>
> 69
> <script type='text/javascript'>
> window.parent.app.update({ name: "Florian", message: "bla" });
> </script>
>
> 69
> <script type='text/javascript'>
> window.parent.app.update({ name: "Florian", message: "bla" });
> </script>
>
> 69
> <script type='text/javascript'>
> window.parent.app.update({ name: "Florian", message: "bla" });
> </script>
>
> 0
>
> It lacks the headers set by the AtmosphereHandler, the Date corresponds
> to one of the POST requests from the browser, not my current request,
> and it contains some of the messages that went missing earlier during
> the experiment.
>
> The log file contains something like correlates with a POST request.
>
> [#|2009-06-04T18:15:25.870+0200|SEVERE|sun-glassfish-comms-server1.5|javax.enterprise.system.container.web|_ThreadID=15;_ThreadName=httpWorkerThread-8080-1;_RequestID=62f8d3f9-7dcf-415f-beee-7b5a79d86a73;|StandardWrapperValve[Atmosphere
> Chat]: PWC1406: Servlet.service() for servlet Atmosphere Chat threw
> exception
> java.lang.IllegalStateException: PWC3999: Cannot create a session after
> the response has been committed
>     at
> org.apache.coyote.tomcat5.CoyoteRequest.doGetSession(CoyoteRequest.java:2847)
>
>     at
> org.apache.coyote.tomcat5.CoyoteRequest.getSession(CoyoteRequest.java:2609)
>     at
> org.apache.coyote.tomcat5.CoyoteRequestFacade.getSession(CoyoteRequestFacade.java:912)
>
>     at
> org.apache.coyote.tomcat5.CoyoteRequestFacade.getSession(CoyoteRequestFacade.java:923)
>
>     at
> org.atmosphere.container.GlassFishv2CometSupport.service(GlassFishv2CometSupport.java:114)
>
>     at
> org.atmosphere.cpr.AtmosphereServlet.service(AtmosphereServlet.java:310)
>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
>
> With my handler, I could post as many messages while no event had ever
> been suspended. after one event was suspended, I could post four
> messages without getting a strange result. If I posted a fifth message,
> the above exception was thrown, and the result ot the post was not the
> text "success", but the text of the four messages. Then I cound post
> four new messages before getting the same error and so on. If more
> events had been suspended, the behaviour changed. This may or may not be
> related to the fact that the server is configured to use up to five
> threads to process requests.

Ok let me try on v2...kind of strange it doesn't work but I will try to
take a look today. I'm at JavaOne so I might not reply as fast as I want :-)


>
> The most specific version information I could find was:
> Sun GlassFish Communications Server 1.5 (9.1.1) (build b60g-fcs)

Thanks a lot for the feedback!!!

-- Jeanfrancois


>
> - Florian.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: GlassfishV2CometSupport doesn't work

Florian Hars-3
Jeanfrancois Arcand wrote:
> Salut,
>
> quck question before I look at it. Did you enable Comet?

No, (that config option is well hidden :-)), but activating it
doesn't change much. Now the sixth POST instead results in a 500
and an exception if I call res.getWriter.flush() in onMessage:

[#|2009-06-05T18:53:26.272+0200|SEVERE|sun-glassfish-comms-server1.5|Atmosphere|_ThreadID=16;_ThreadName=httpWorkerThread-8080-0;_RequestID=ffd86940-796c-4b5d-89c4-5123e63f2606;|AtmosphereServlet
exception
java.lang.IllegalStateException: Invalid Response State. SocketChannel
cannot be null.
         at
com.sun.enterprise.web.connector.grizzly.OutputWriter.flushChannel(OutputWriter.java:82)
         at
com.sun.enterprise.web.connector.grizzly.OutputWriter.flushChannel(OutputWriter.java:65)
         at
com.sun.enterprise.web.connector.grizzly.SocketChannelOutputBuffer.flushChannel(SocketChannelOutputBuffer.java:170)
         at
com.sun.enterprise.web.connector.grizzly.async.AsynchronousOutputBuffer.flushChannel(AsynchronousOutputBuffer.java:81)
         at
com.sun.enterprise.web.connector.grizzly.SocketChannelOutputBuffer.flushBuffer(SocketChannelOutputBuffer.java:203)
         at
com.sun.enterprise.web.connector.grizzly.async.AsynchronousOutputBuffer.flushBuffer(AsynchronousOutputBuffer.java:113)
         at
com.sun.enterprise.web.connector.grizzly.SocketChannelOutputBuffer.flush(SocketChannelOutputBuffer.java:181)
         at
com.sun.enterprise.web.connector.grizzly.async.AsynchronousOutputBuffer.flush(AsynchronousOutputBuffer.java:103)
         at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.action(DefaultProcessorTask.java:1059)
         at org.apache.coyote.Response.action(Response.java:237)
         at
org.apache.coyote.tomcat5.OutputBuffer.doFlush(OutputBuffer.java:381)
         at
org.apache.coyote.tomcat5.OutputBuffer.flush(OutputBuffer.java:352)
         at
org.apache.coyote.tomcat5.CoyoteWriter.flush(CoyoteWriter.java:151)

> I'm at JavaOne so I might not reply as fast as I want

I kind of expected that :-).

- Florian.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: GlassfishV2CometSupport doesn't work

Jeanfrancois Arcand
Salut,

I've updated a version that fix the problem. I did test the chat and now
it works fine. Give it a try and let me know.

Thanks!

-- Jeanfrancois

Florian Hars wrote:

> Jeanfrancois Arcand wrote:
>> Salut,
>>
>> quck question before I look at it. Did you enable Comet?
>
> No, (that config option is well hidden :-)), but activating it
> doesn't change much. Now the sixth POST instead results in a 500
> and an exception if I call res.getWriter.flush() in onMessage:
>
> [#|2009-06-05T18:53:26.272+0200|SEVERE|sun-glassfish-comms-server1.5|Atmosphere|_ThreadID=16;_ThreadName=httpWorkerThread-8080-0;_RequestID=ffd86940-796c-4b5d-89c4-5123e63f2606;|AtmosphereServlet
> exception
> java.lang.IllegalStateException: Invalid Response State. SocketChannel
> cannot be null.
>         at
> com.sun.enterprise.web.connector.grizzly.OutputWriter.flushChannel(OutputWriter.java:82)
>
>         at
> com.sun.enterprise.web.connector.grizzly.OutputWriter.flushChannel(OutputWriter.java:65)
>
>         at
> com.sun.enterprise.web.connector.grizzly.SocketChannelOutputBuffer.flushChannel(SocketChannelOutputBuffer.java:170)
>
>         at
> com.sun.enterprise.web.connector.grizzly.async.AsynchronousOutputBuffer.flushChannel(AsynchronousOutputBuffer.java:81)
>
>         at
> com.sun.enterprise.web.connector.grizzly.SocketChannelOutputBuffer.flushBuffer(SocketChannelOutputBuffer.java:203)
>
>         at
> com.sun.enterprise.web.connector.grizzly.async.AsynchronousOutputBuffer.flushBuffer(AsynchronousOutputBuffer.java:113)
>
>         at
> com.sun.enterprise.web.connector.grizzly.SocketChannelOutputBuffer.flush(SocketChannelOutputBuffer.java:181)
>
>         at
> com.sun.enterprise.web.connector.grizzly.async.AsynchronousOutputBuffer.flush(AsynchronousOutputBuffer.java:103)
>
>         at
> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.action(DefaultProcessorTask.java:1059)
>
>         at org.apache.coyote.Response.action(Response.java:237)
>         at
> org.apache.coyote.tomcat5.OutputBuffer.doFlush(OutputBuffer.java:381)
>         at
> org.apache.coyote.tomcat5.OutputBuffer.flush(OutputBuffer.java:352)
>         at
> org.apache.coyote.tomcat5.CoyoteWriter.flush(CoyoteWriter.java:151)
>
>> I'm at JavaOne so I might not reply as fast as I want
>
> I kind of expected that :-).
>
> - Florian.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: GlassfishV2CometSupport doesn't work

Jeanfrancois Arcand
You can download the new binary here:

http://download.java.net/maven/2/org/atmosphere/atmosphere-portable-runtime/0.2-SNAPSHOT/

Thanks

-- Jeanfrancois

Jeanfrancois Arcand wrote:

> Salut,
>
> I've updated a version that fix the problem. I did test the chat and now
> it works fine. Give it a try and let me know.
>
> Thanks!
>
> -- Jeanfrancois
>
> Florian Hars wrote:
>> Jeanfrancois Arcand wrote:
>>> Salut,
>>>
>>> quck question before I look at it. Did you enable Comet?
>>
>> No, (that config option is well hidden :-)), but activating it
>> doesn't change much. Now the sixth POST instead results in a 500
>> and an exception if I call res.getWriter.flush() in onMessage:
>>
>> [#|2009-06-05T18:53:26.272+0200|SEVERE|sun-glassfish-comms-server1.5|Atmosphere|_ThreadID=16;_ThreadName=httpWorkerThread-8080-0;_RequestID=ffd86940-796c-4b5d-89c4-5123e63f2606;|AtmosphereServlet
>> exception
>> java.lang.IllegalStateException: Invalid Response State. SocketChannel
>> cannot be null.
>>         at
>> com.sun.enterprise.web.connector.grizzly.OutputWriter.flushChannel(OutputWriter.java:82)
>>
>>         at
>> com.sun.enterprise.web.connector.grizzly.OutputWriter.flushChannel(OutputWriter.java:65)
>>
>>         at
>> com.sun.enterprise.web.connector.grizzly.SocketChannelOutputBuffer.flushChannel(SocketChannelOutputBuffer.java:170)
>>
>>         at
>> com.sun.enterprise.web.connector.grizzly.async.AsynchronousOutputBuffer.flushChannel(AsynchronousOutputBuffer.java:81)
>>
>>         at
>> com.sun.enterprise.web.connector.grizzly.SocketChannelOutputBuffer.flushBuffer(SocketChannelOutputBuffer.java:203)
>>
>>         at
>> com.sun.enterprise.web.connector.grizzly.async.AsynchronousOutputBuffer.flushBuffer(AsynchronousOutputBuffer.java:113)
>>
>>         at
>> com.sun.enterprise.web.connector.grizzly.SocketChannelOutputBuffer.flush(SocketChannelOutputBuffer.java:181)
>>
>>         at
>> com.sun.enterprise.web.connector.grizzly.async.AsynchronousOutputBuffer.flush(AsynchronousOutputBuffer.java:103)
>>
>>         at
>> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.action(DefaultProcessorTask.java:1059)
>>
>>         at org.apache.coyote.Response.action(Response.java:237)
>>         at
>> org.apache.coyote.tomcat5.OutputBuffer.doFlush(OutputBuffer.java:381)
>>         at
>> org.apache.coyote.tomcat5.OutputBuffer.flush(OutputBuffer.java:352)
>>         at
>> org.apache.coyote.tomcat5.CoyoteWriter.flush(CoyoteWriter.java:151)
>>
>>> I'm at JavaOne so I might not reply as fast as I want
>>
>> I kind of expected that :-).
>>
>> - Florian.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: GlassfishV2CometSupport doesn't work

Florian Hars-3
Jeanfrancois Arcand wrote:
> You can download the new binary here:

Works, thanks.

- Florian.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]