users@glassfish.java.net

Re: (Comet) Running GlassFish with mod_proxy

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Fri, 27 Jun 2008 11:11:39 -0400

Salut,

(adding Comet to the title so it will makes easier for peoples to search).

glassfish_at_javadesktop.org wrote:
> Hi,
> I am writing a WebChat system using HTTP streaming by reference to
> http://docs.sun.com/app/docs/doc/820-4496/ggrgy
>
> The application have to close the XMPP connection when the browser reloaded or exit.
> So, I had created the CometHandler like below.
>
> MyCometHandler:
> public void onTerminate(CometEvent event) throws IOException {
> onInterrupt(event);
> }
> public void onInterrupt(CometEvent event) throws IOException {
> logger.info("close");
> writer.close();
> event.getCometContext().removeCometHandler(this);
> // XMPP Connection close
> ....
> }
>
> I accessed the glassfish directly, it worked fine,
> and the onInterrupt method is called immediately.
>
> So, I try to access the glassfish through the apache mod_proxy.
> that followed the instruction in
> http://forums.java.net/jive/thread.jspa?messageID=276500
>
> The application works fine.
> but I realize the onInterrupt method isn't called in spite of the browser exit.
> It called after timeout. I want to call it immediately.
>
> My test environment is:
> ・GlassFish v3 TP2
> ・Apach httpd(mod_proxy) 2.2.9
> ・Windows XP
>
> My mod_proxy configuration in httpd.conf is:
> <VirtualHost *:80>
> <Location ...>
> ProxyPass http://localhost:8080/webchat/
> ProxyPassReverse http://localhost:8080/webchat/
> </Location>
> </VirtualHost>
>
> If anyone resolved this problem, please tell me the solution.
> Thanks!

Hum...no simple to debug :-)

[1] I suspect mod_proxy isn't closing the connection immediately ( I
could be completely wrong) and might delay it.

[2] Can I send you a Grizzly patch that contains debugging information?
Inside that patch I will add extra logging to see if the connection is
really closed. If the connection is closed, I suspect there is somes
bytes that are sen by mod_proxy, and Grizzly thinks this is a pipelined
http requests. In that case, and since Grizzly Comet supports
asynchronous I/O (read and write), the Comet engine might think this is
an event for your CometHandler, but since you haven't registed to get
notified, the event goes nowhere.

I unfortunalty don't have time today to install your config, but if you
cannot patch GlassFish I will try next week.

Thanks

-- Jeanfrancois



> [Message sent by forum member 'kzri' (kzri)]
>
> http://forums.java.net/jive/thread.jspa?messageID=282916
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>