users@grizzly.java.net

Re: Grizzly+Comet question

From: Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM>
Date: Fri, 05 Mar 2010 17:38:15 +0100

Well, I think it's because of this:

     public void init(ServletConfig config) throws ServletException {
         super.init(config);
         System.out.println("init !!!!!!!!!!!!");


Exception happens during super.init(config) execution, so control
doesn't come to System.out 2nd time.

WBR,
Alexey.

On Mar 5, 2010, at 17:32 , Lillian Angel wrote:

> The other interesting point is that the println that prints
> "init !!!!!!!!!!!!|" only gets printed once. And the println is
> called before the register. It is interesting that it is not printed
> the "second" time init is called....
>
> init():
>
> System.out.println("init !!!!!!!!!!!!");
>
> ServletContext context = config.getServletContext();
> contextPath = context.getContextPath() + "/in.erraiBus";
> CometEngine engine = CometEngine.getEngine();
> CometContext cometContext = engine.register(contextPath);
> cometContext.setExpirationDelay(120 * 1000);
>
>
>
> On 2010-03-05, at 10:35 AM, Lillian Angel wrote:
>
>> But load-on-startup is disabled, it is set to 0. For me, at least,
>> I am not seeing "ThreadName=httpWorkerThread-4848".
>>
>> Just a note, it is not deployed on the admin listener.
>>
>> I believe it should not be initialized at the beginning, and the
>> second init call is correct. It should be initialized when the
>> servlet is put into action.
>>
>>
>>
>>
>> On 2010-03-05, at 4:35 AM, Oleksiy Stashok wrote:
>>
>>> I think it's normal situation, when load-on-startup is enabled -
>>> then servlet is getting initialized in worker-thread-pool-4848.
>>> The real question for me is why the servlet gets initialized, then
>>> we see service, doGet method calls and then the same servlet gets
>>> initialized again.
>>>
>>> Alexey.
>>>
>>>
>>> On Mar 5, 2010, at 0:01 , Justin Lee wrote:
>>>
>>>> Look at the differing worker thread names. The first is
>>>> httpWorkerThread-4848-0 (the *admin* context) and the second is
>>>> httpSSLWorkerThread-8080-1. So it looks to me like maybe the
>>>> deployment is getting screwed up some how. That servlet should
>>>> never show up on the admin context. In fact, the code explicitly
>>>> attempts to disallow comet on the admin context (at least on
>>>> v3). So seeing that thread name show up is a little disconcerting.
>>>>
>>>> On 3/4/10 4:29 PM, Oleksiy Stashok wrote:
>>>>> Here is snippet from my server.log [1].
>>>>> Take a look at line "init !!!!!!!!" it's first time, and the
>>>>> actual exception happens during the second init call.
>>>>>
>>>>> WBR,
>>>>> Alexey.
>>>>>
>>>>>
>>>>> [1]
>>>>> [#|2010-03-04T11:02:14.638+0100|WARNING|sun-appserver2.1|
>>>>> javax.enterprise.system.stream.err|
>>>>> _ThreadID
>>>>> =14;_ThreadName=httpWorkerThread-4848-0;_RequestID=70e80ea1-
>>>>> cbce-4f13-95b7-6bd7cb3dfe96;|INFO [ErraiServiceConfigurator]
>>>>> Errai bootstraping complete!
>>>>> |#]
>>>>>
>>>>> [#|2010-03-04T11:02:14.639+0100|INFO|sun-appserver2.1|
>>>>> javax.enterprise.system.stream.out|
>>>>> _ThreadID=14;_ThreadName=httpWorkerThread-4848-0;|
>>>>> init !!!!!!!!!!!!|#]
>>>>>
>>>>> [#|2010-03-04T11:04:53.795+0100|INFO|sun-appserver2.1|
>>>>> javax.enterprise.system.stream.out|
>>>>> _ThreadID=16;_ThreadName=httpSSLWorkerThread-8080-1;|
>>>>> service !!!!!!!!!!!!!GET|#]
>>>>>
>>>>> [#|2010-03-04T11:04:53.795+0100|INFO|sun-appserver2.1|
>>>>> javax.enterprise.system.stream.out|
>>>>> _ThreadID=16;_ThreadName=httpSSLWorkerThread-8080-1;|
>>>>> doGet !!!!!!!!!!!!|#]
>>>>>
>>>>> [#|2010-03-04T11:04:53.802+0100|INFO|sun-appserver2.1|
>>>>> javax.enterprise.system.stream.out|
>>>>> _ThreadID=16;_ThreadName=httpSSLWorkerThread-8080-1;|
>>>>> attach !!!!!!!!!!!!|#]
>>>>>
>>>>> [#|2010-03-04T11:04:53.804+0100|SEVERE|sun-appserver2.1|
>>>>> javax.enterprise.system.container.web|
>>>>> _ThreadID
>>>>> =16;_ThreadName=httpSSLWorkerThread-8080-1;_RequestID=8d7f826a-
>>>>> ff67-41cb-9ffb-f36fe6bc7597;|
>>>>> StandardWrapperValve[GrizzlyErraiServlet]: PWC1406:
>>>>> Servlet.service() for servlet GrizzlyErraiServlet threw exception
>>>>> java.lang.IllegalStateException: Make sure you have enabled
>>>>> Comet or make sure the Thread invoking that method is the same
>>>>> as the Servlet.service() Thread.
>>>>> at com.sun.grizzly.comet.CometContext.<clinit>(CometContext.java:
>>>>> 183)
>>>>> at com.sun.grizzly.comet.CometEngine.register(CometEngine.java:
>>>>> 285)
>>>>> at com.sun.grizzly.comet.CometEngine.register(CometEngine.java:
>>>>> 260)
>>>>> at com.sun.grizzly.comet.CometEngine.register(CometEngine.java:
>>>>> 245)
>>>>> at
>>>>> org
>>>>> .jboss
>>>>> .errai
>>>>> .bus
>>>>> .server
>>>>> .servlet.GrizzlyCometServlet.init(GrizzlyCometServlet.java:44)
>>>>> at
>>>>> org
>>>>> .apache
>>>>> .catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:
>>>>> 1100)
>>>>> at
>>>>> org
>>>>> .apache.catalina.core.StandardWrapper.load(StandardWrapper.java:
>>>>> 1023)
>>>>> at
>>>>> org
>>>>> .apache
>>>>> .catalina
>>>>> .core.StandardContext.loadOnStartup(StandardContext.java:4969)
>>>>> at
>>>>> org
>>>>> .apache.catalina.core.StandardContext.start(StandardContext.java:
>>>>> 5376)
>>>>> at com.sun.enterprise.web.WebModule.start(WebModule.java:345)
>>>>>
>>>>> On Mar 4, 2010, at 22:20 , Lillian Angel wrote:
>>>>>
>>>>>> Odd, I am not seeing it being initialized twice, but i am going
>>>>>> to keep trying to reproduce that. Thanks
>>>>>>
>>>>>>
>>>>>> On 2010-03-04, at 4:13 PM, Oleksiy Stashok wrote:
>>>>>>
>>>>>>> Hi Lillian,
>>>>>>>
>>>>>>>> Do the versions have anything to do with this?
>>>>>>>> I am using the grizzly 1.9.19-beta libraries, and glassfish v2.
>>>>>>> I think it's fine (Sailfin does the same).
>>>>>>> Your app may use a lot of threads - that's fine, the question
>>>>>>> is why the same servlet gets initialized twice? :)
>>>>>>> I think your usecase is not so simple, as jmaki-comet ;)
>>>>>>>
>>>>>>> WBR,
>>>>>>> Alexey.
>>>>>>>
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>>
>>>>>>>>
>>>>>>>> On 2010-03-04, at 5:13 AM, Oleksiy Stashok wrote:
>>>>>>>>
>>>>>>>>> Hi Lillian,
>>>>>>>>>
>>>>>>>>> I guess I need to see more source files, or understand the
>>>>>>>>> usecase better.
>>>>>>>>> Cause the first problem I see right away it's why servlet
>>>>>>>>> init is getting called 2 times?
>>>>>>>>>
>>>>>>>>> WBR,
>>>>>>>>> Alexey.
>>>>>>>>>
>>>>>>>>> On Mar 3, 2010, at 20:28 , Lillian Angel wrote:
>>>>>>>>>
>>>>>>>>>> By disable do you mean "remove"? I still get the same
>>>>>>>>>> original error :(
>>>>>>>>>>
>>>>>>>>>> my web.xml:
>>>>>>>>>>
>>>>>>>>>> <servlet>
>>>>>>>>>> <servlet-name>GrizzlyErraiServlet</servlet-name>
>>>>>>>>>> <servlet-
>>>>>>>>>> class
>>>>>>>>>> >org.jboss.errai.bus.server.servlet.GrizzlyCometServlet</
>>>>>>>>>> servlet-class>
>>>>>>>>>> <!-- <load-on-startup>0</load-on-startup> -->
>>>>>>>>>> </servlet>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 2010-03-03, at 12:47 PM, Oleksiy Stashok wrote:
>>>>>>>>>>
>>>>>>>>>>> Interesting...
>>>>>>>>>>>
>>>>>>>>>>> Lillian, did you try to disable "load-on-startup" for the
>>>>>>>>>>> servlet?
>>>>>>>>>>>
>>>>>>>>>>> WBR,
>>>>>>>>>>> Alexey.
>>>>>>>>>>>
>>>>>>>>>>> On Mar 2, 2010, at 17:40 , Lillian Angel wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>> I am told you are the person I should be contacting for
>>>>>>>>>>>> help :)
>>>>>>>>>>>>
>>>>>>>>>>>> I am creating a comet servlet for the Jboss Errai
>>>>>>>>>>>> project. I am using Glassfish V2. I have enabled
>>>>>>>>>>>> cometSupport in the domain.xml (the jmaki-comet demo
>>>>>>>>>>>> works well!), but I keep running into the error below. I
>>>>>>>>>>>> can't figure out why it is being thrown, as the thread
>>>>>>>>>>>> invoking the methods all seem to be the same as well.
>>>>>>>>>>>>
>>>>>>>>>>>> To reproduce, I have uploaded the war here: http://langel.fedorapeople.org/errai-samples-store-1.1-SNAPSHOT.war
>>>>>>>>>>>>
>>>>>>>>>>>> I have modified org/jboss/errai/bus/server/servlet/
>>>>>>>>>>>> GrizzlyCometServlet.java to print statements for every
>>>>>>>>>>>> function it hits. Right now the code is pretty rough and
>>>>>>>>>>>> most likely incorrect, but it is based on the grizzly
>>>>>>>>>>>> +comet demo (http://docs.sun.com/app/docs/doc/820-4496/ggrgt?a=view
>>>>>>>>>>>> ) and should be working a bit better than it is now. See
>>>>>>>>>>>> the error below.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> If you have an insight, please share!
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks a lot!
>>>>>>>>>>>> Lillian
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> [#|2010-03-02T11:02:29.447-0500|INFO|sun-appserver2.1|
>>>>>>>>>>>> javax.enterprise.system.stream.out|
>>>>>>>>>>>> _ThreadID=21;_ThreadName=httpWorkerThread-8080-0;|
>>>>>>>>>>>> 14 service !!!!!!!!!!!!!GET|#]
>>>>>>>>>>>> 15
>>>>>>>>>>>> 16 [#|2010-03-02T11:02:29.448-0500|INFO|sun-appserver2.1|
>>>>>>>>>>>> javax.enterprise.system.stream.out|
>>>>>>>>>>>> _ThreadID=21;_ThreadName=httpWorkerThread-8080-0;|
>>>>>>>>>>>> 17 doGet !!!!!!!!!!!!|#]
>>>>>>>>>>>> 18
>>>>>>>>>>>> 19 [#|2010-03-02T11:02:29.448-0500|INFO|sun-appserver2.1|
>>>>>>>>>>>> javax.enterprise.system.stream.out|
>>>>>>>>>>>> _ThreadID=21;_ThreadName=httpWorkerThread-8080-0;| 20
>>>>>>>>>>>> attach !!!!!!!!!!!!|#]
>>>>>>>>>>>>
>>>>>>>>>>>> 21 22 [#|2010-03-02T11:02:29.448-0500|SEVERE|sun-
>>>>>>>>>>>> appserver2.1|javax.enterprise.system.container.web|
>>>>>>>>>>>> _ThreadID=21;_Thre
>>>>>>>>>>>> adName
>>>>>>>>>>>> =
>>>>>>>>>>>> httpWorkerThread
>>>>>>>>>>>> -8080-0;_RequestID=8e5691c7-2c78-4e1f-80c1-cee36fe1f247;|
>>>>>>>>>>>> StandardWrapperValve[GrizzlyErraiServlet]: PWC1406:
>>>>>>>>>>>> Servlet.service() for servlet GrizzlyErraiServlet threw
>>>>>>>>>>>> exception
>>>>>>>>>>>> 23 java.lang.IllegalStateException: Make sure you have
>>>>>>>>>>>> enabled Comet or make sure the Thread invoking that
>>>>>>>>>>>> method i
>>>>>>>>>>>> s the same as the Servlet.service() Thread.
>>>>>>>>>>>> 24 at
>>>>>>>>>>>> com
>>>>>>>>>>>> .sun
>>>>>>>>>>>> .grizzly.comet.CometContext.<clinit>(CometContext.java:183)
>>>>>>>>>>>> 25 at
>>>>>>>>>>>> com
>>>>>>>>>>>> .sun.grizzly.comet.CometEngine.register(CometEngine.java:
>>>>>>>>>>>> 285)
>>>>>>>>>>>> 26 at
>>>>>>>>>>>> com
>>>>>>>>>>>> .sun.grizzly.comet.CometEngine.register(CometEngine.java:
>>>>>>>>>>>> 260)
>>>>>>>>>>>> 27 at
>>>>>>>>>>>> com
>>>>>>>>>>>> .sun.grizzly.comet.CometEngine.register(CometEngine.java:
>>>>>>>>>>>> 245)
>>>>>>>>>>>> 28 at
>>>>>>>>>>>> org
>>>>>>>>>>>> .jboss
>>>>>>>>>>>> .errai
>>>>>>>>>>>> .bus
>>>>>>>>>>>> .server
>>>>>>>>>>>> .servlet
>>>>>>>>>>>> .GrizzlyCometServlet.init(GrizzlyCometServlet.java:44)
>>>>>>>>>>>> 29 at
>>>>>>>>>>>> org
>>>>>>>>>>>> .apache
>>>>>>>>>>>> .catalina
>>>>>>>>>>>> .core.StandardWrapper.loadServlet(StandardWrapper.java:
>>>>>>>>>>>> 1100)
>>>>>>>>>>>> 30 at
>>>>>>>>>>>> org
>>>>>>>>>>>> .apache
>>>>>>>>>>>> .catalina.core.StandardWrapper.load(StandardWrapper.java:
>>>>>>>>>>>> 1023)
>>>>>>>>>>>> 31 at
>>>>>>>>>>>> org
>>>>>>>>>>>> .apache
>>>>>>>>>>>> .catalina
>>>>>>>>>>>> .core.StandardContext.loadOnStartup(StandardContext.java:
>>>>>>>>>>>> 4969)
>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>>>>>>>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>>>>>>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: users-
>>>>>>>>>> unsubscribe_at_grizzly.dev.java.net
>>>>>>>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>>>>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>>>>>> For additional commands, e-mail: users-
>>>>>>>> help_at_grizzly.dev.java.net
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>