You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Igor Urisman <ig...@gmail.com> on 2013/08/30 23:33:20 UTC

8.0.0-RC1: WebSocket Exception

Dear all,

Getting the following exception with none of my code on the stack:

SEVERE: Error reading request, ignored
java.lang.IllegalStateException: The WebSocket session has been closed and
no method (apart from close()) may be called on a closed session
    at org.apache.tomcat.websocket.WsSession.checkState(WsSession.java:607)
    at
org.apache.tomcat.websocket.WsSession.getUserPrincipal(WsSession.java:536)
    at
org.apache.tomcat.websocket.server.WsServerContainer.registerSession(WsServerContainer.java:308)
    at
org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.init(WsHttpUpgradeHandler.java:131)
    at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
    at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
    at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1592)
    at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1550)
    at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)

May still be my problem, of course, but far as I can tell, all I do is call
Session.close()  once on this session.  I understand this may be too little
to go by,-- if so I am happy to try and isolate into a testcase.

Thanks in advance,
-Igor.

Re: 8.0.0-RC1: WebSocket Exception

Posted by Igor Urisman <ig...@gmail.com>.
Right on.  Thank you both, Mark and Niki.
-Igor.


On Sun, Sep 1, 2013 at 3:00 AM, Mark Thomas <ma...@apache.org> wrote:

> On 31/08/2013 02:40, Igor Urisman wrote:
> > That's correct.  I call close() inside onOpen().  You correctly call
> > onClose() on the endpoint as well, so my code is happy.  But a thread of
> > yours crashes milliseconds later. I have no problem changing my code to
> > call close() after onOpen() returns, of course.  But if you insist on
> this
> > semantics, perhaps you ought to throw an exception in my thread when I
> call
> > close() inside onOpen()?
>
> No need to change your code. This has already been fixed in trunk and
> will be included in 8.0.0-RC2.
>
> RC2 has been delayed because it needs a tc-native release to fix a
> non-blocking IO issue with the APR/native connector that can result in
> corruption of responses.
>
> The 1.1.28 release of tc-native should happen this week. The 7.0.43 and
> 8.0.0-RC2 releases will follow shortly afterwards.
>
> Mark
>
>
> >
> > Thanks!
> > -Igor.
> >
> >
> > On Fri, Aug 30, 2013 at 6:12 PM, Niki Dokovski <ni...@gmail.com>
> wrote:
> >
> >> On Sat, Aug 31, 2013 at 12:33 AM, Igor Urisman <igor.urisman@gmail.com
> >>> wrote:
> >>
> >>> Dear all,
> >>>
> >>> Getting the following exception with none of my code on the stack:
> >>>
> >>> SEVERE: Error reading request, ignored
> >>> java.lang.IllegalStateException: The WebSocket session has been closed
> >> and
> >>> no method (apart from close()) may be called on a closed session
> >>>     at
> >> org.apache.tomcat.websocket.WsSession.checkState(WsSession.java:607)
> >>>     at
> >>>
> >>
> org.apache.tomcat.websocket.WsSession.getUserPrincipal(WsSession.java:536)
> >>>     at
> >>>
> >>>
> >>
> org.apache.tomcat.websocket.server.WsServerContainer.registerSession(WsServerContainer.java:308)
> >>>     at
> >>>
> >>>
> >>
> org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.init(WsHttpUpgradeHandler.java:131)
> >>>     at
> >>>
> >>>
> >>
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
> >>>     at
> >>>
> >>>
> >>
> org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
> >>>     at
> >>>
> >>>
> >>
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1592)
> >>>     at
> >>>
> >>>
> >>
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1550)
> >>>     at
> >>>
> >>>
> >>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> >>>     at
> >>>
> >>>
> >>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> >>>     at java.lang.Thread.run(Thread.java:722)
> >>>
> >>> May still be my problem, of course, but far as I can tell, all I do is
> >> call
> >>> Session.close()  once on this session.  I understand this may be too
> >> little
> >>> to go by,-- if so I am happy to try and isolate into a testcase.
> >>>
> >>
> >> Do you call close during @OnOpen? This exception here is possible in
> this
> >> case as register session call is done after invkoing applicaiton ep
> OnOpen?
> >>
> >>>
> >>> Thanks in advance,
> >>> -Igor.
> >>>
> >>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: 8.0.0-RC1: WebSocket Exception

Posted by Mark Thomas <ma...@apache.org>.
On 31/08/2013 02:40, Igor Urisman wrote:
> That's correct.  I call close() inside onOpen().  You correctly call
> onClose() on the endpoint as well, so my code is happy.  But a thread of
> yours crashes milliseconds later. I have no problem changing my code to
> call close() after onOpen() returns, of course.  But if you insist on this
> semantics, perhaps you ought to throw an exception in my thread when I call
> close() inside onOpen()?

No need to change your code. This has already been fixed in trunk and
will be included in 8.0.0-RC2.

RC2 has been delayed because it needs a tc-native release to fix a
non-blocking IO issue with the APR/native connector that can result in
corruption of responses.

The 1.1.28 release of tc-native should happen this week. The 7.0.43 and
8.0.0-RC2 releases will follow shortly afterwards.

Mark


> 
> Thanks!
> -Igor.
> 
> 
> On Fri, Aug 30, 2013 at 6:12 PM, Niki Dokovski <ni...@gmail.com> wrote:
> 
>> On Sat, Aug 31, 2013 at 12:33 AM, Igor Urisman <igor.urisman@gmail.com
>>> wrote:
>>
>>> Dear all,
>>>
>>> Getting the following exception with none of my code on the stack:
>>>
>>> SEVERE: Error reading request, ignored
>>> java.lang.IllegalStateException: The WebSocket session has been closed
>> and
>>> no method (apart from close()) may be called on a closed session
>>>     at
>> org.apache.tomcat.websocket.WsSession.checkState(WsSession.java:607)
>>>     at
>>>
>> org.apache.tomcat.websocket.WsSession.getUserPrincipal(WsSession.java:536)
>>>     at
>>>
>>>
>> org.apache.tomcat.websocket.server.WsServerContainer.registerSession(WsServerContainer.java:308)
>>>     at
>>>
>>>
>> org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.init(WsHttpUpgradeHandler.java:131)
>>>     at
>>>
>>>
>> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
>>>     at
>>>
>>>
>> org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
>>>     at
>>>
>>>
>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1592)
>>>     at
>>>
>>>
>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1550)
>>>     at
>>>
>>>
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>>>     at
>>>
>>>
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>>>     at java.lang.Thread.run(Thread.java:722)
>>>
>>> May still be my problem, of course, but far as I can tell, all I do is
>> call
>>> Session.close()  once on this session.  I understand this may be too
>> little
>>> to go by,-- if so I am happy to try and isolate into a testcase.
>>>
>>
>> Do you call close during @OnOpen? This exception here is possible in this
>> case as register session call is done after invkoing applicaiton ep OnOpen?
>>
>>>
>>> Thanks in advance,
>>> -Igor.
>>>
>>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: 8.0.0-RC1: WebSocket Exception

Posted by Igor Urisman <ig...@gmail.com>.
That's correct.  I call close() inside onOpen().  You correctly call
onClose() on the endpoint as well, so my code is happy.  But a thread of
yours crashes milliseconds later. I have no problem changing my code to
call close() after onOpen() returns, of course.  But if you insist on this
semantics, perhaps you ought to throw an exception in my thread when I call
close() inside onOpen()?

Thanks!
-Igor.


On Fri, Aug 30, 2013 at 6:12 PM, Niki Dokovski <ni...@gmail.com> wrote:

> On Sat, Aug 31, 2013 at 12:33 AM, Igor Urisman <igor.urisman@gmail.com
> >wrote:
>
> > Dear all,
> >
> > Getting the following exception with none of my code on the stack:
> >
> > SEVERE: Error reading request, ignored
> > java.lang.IllegalStateException: The WebSocket session has been closed
> and
> > no method (apart from close()) may be called on a closed session
> >     at
> org.apache.tomcat.websocket.WsSession.checkState(WsSession.java:607)
> >     at
> >
> org.apache.tomcat.websocket.WsSession.getUserPrincipal(WsSession.java:536)
> >     at
> >
> >
> org.apache.tomcat.websocket.server.WsServerContainer.registerSession(WsServerContainer.java:308)
> >     at
> >
> >
> org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.init(WsHttpUpgradeHandler.java:131)
> >     at
> >
> >
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
> >     at
> >
> >
> org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
> >     at
> >
> >
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1592)
> >     at
> >
> >
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1550)
> >     at
> >
> >
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> >     at
> >
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> >     at java.lang.Thread.run(Thread.java:722)
> >
> > May still be my problem, of course, but far as I can tell, all I do is
> call
> > Session.close()  once on this session.  I understand this may be too
> little
> > to go by,-- if so I am happy to try and isolate into a testcase.
> >
>
> Do you call close during @OnOpen? This exception here is possible in this
> case as register session call is done after invkoing applicaiton ep OnOpen?
>
> >
> > Thanks in advance,
> > -Igor.
> >
>

Re: 8.0.0-RC1: WebSocket Exception

Posted by Niki Dokovski <ni...@gmail.com>.
On Sat, Aug 31, 2013 at 12:33 AM, Igor Urisman <ig...@gmail.com>wrote:

> Dear all,
>
> Getting the following exception with none of my code on the stack:
>
> SEVERE: Error reading request, ignored
> java.lang.IllegalStateException: The WebSocket session has been closed and
> no method (apart from close()) may be called on a closed session
>     at org.apache.tomcat.websocket.WsSession.checkState(WsSession.java:607)
>     at
> org.apache.tomcat.websocket.WsSession.getUserPrincipal(WsSession.java:536)
>     at
>
> org.apache.tomcat.websocket.server.WsServerContainer.registerSession(WsServerContainer.java:308)
>     at
>
> org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.init(WsHttpUpgradeHandler.java:131)
>     at
>
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
>     at
>
> org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
>     at
>
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1592)
>     at
>
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1550)
>     at
>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>     at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>     at java.lang.Thread.run(Thread.java:722)
>
> May still be my problem, of course, but far as I can tell, all I do is call
> Session.close()  once on this session.  I understand this may be too little
> to go by,-- if so I am happy to try and isolate into a testcase.
>

Do you call close during @OnOpen? This exception here is possible in this
case as register session call is done after invkoing applicaiton ep OnOpen?

>
> Thanks in advance,
> -Igor.
>