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 <nick...@gmail.com> wrote:

> On Sat, Aug 31, 2013 at 12:33 AM, Igor Urisman <igor.uris...@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.
> >
>

Reply via email to