Thank you very much for help. Best regards, Funian Li
2018-04-18 19:00 GMT+08:00 Mark Thomas <ma...@apache.org>: > On 13/04/18 09:47, Mark Thomas wrote: > > On 13/04/18 03:13, Funian Li wrote: > >> 2018-04-12 4:19 GMT+08:00 Mark Thomas <ma...@apache.org>: > >> > >>> On 11/04/18 09:50, Funian Li wrote: > >>>> Dear All, > >>>> > >>>> A problem happen when tomcat websocket server was used. > >>> > >>>> Exact Tomcat version? > >>> > >>>> If not 8.5.30, does the problem still occur if you upgrade to 8.5.30? > >>> > >>>> Mark > >>> > >> > >> Yes , the exact Tomcat version is 8.5.30, shall i upgrade to tomcat > 9.0 ? > > > > Thanks for the version information. > > > > An upgrade to 9.0.x is unlikely to help. The code is almost identical > > between 8.5.x and 9.0.x. > > > > The next step will be to try the test case you provided to see if the > > problem can be reproduced. > > Adding the code to my (resurrected) github project for Tomcat test > cases[1] and formatting the code made the root cause obvious. > > As per the Java WebSocket specification: > <quote> > [WSC-5.1-1] In all cases, the implementation must not invoke an > endpoint instance with more than one thread per peer at a time. > </quote> > > In onMessage() a loop is entered (on the container thread for that peer) > that can never be exited because the stop message will never be > processed because that requires a container thread and the only > container thread allowed is processing the loop. > > The fix is to spwan a new thread in onMessage() and use that to write > the messages. > > Mark > > > [1] https://github.com/markt-asf/tomcat-bugs > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >