https://issues.apache.org/bugzilla/show_bug.cgi?id=56026
Bug ID: 56026 Summary: RemoteEndpoint.Async#sendText(String, SendHandler) not thread safe Product: Tomcat 8 Version: trunk Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P2 Component: WebSocket Assignee: dev@tomcat.apache.org Reporter: simone.bor...@gmail.com If an application calls RemoteEndpoint.Async#sendText(String, SendHandler) concurrently from 2 (or more) threads, it gets the stack trace below. Applications should not worry about synchronizing or queuing concurrent calls to Async.sendText() (or similar methods). A simple chat application with 3 users chatting will result in concurrent calls to Async.sendText() when A and B both send a message that must be delivered to C, so the use case is pretty common. Having application worry about synchronizing or queuing concurrent calls to Async.sendText() will put a huge burden to applications that perform concurrent writes, and I believe this was not the intent of JSR 356 (although the specification does not say anything about concurrency guarantees). Thanks ! ~~~~~~~~ 2014-01-17 09:28:30,732 pool-1-thread-12 [ WARN][WebSocketTransport] java.lang.IllegalStateException: The remote endpoint was in state [TEXT_FULL_WRITING] which is an invalid state for called method at org.apache.tomcat.websocket.WsRemoteEndpointImplBase$StateMachine.checkState(WsRemoteEndpointImplBase.java:1049) at org.apache.tomcat.websocket.WsRemoteEndpointImplBase$StateMachine.textStart(WsRemoteEndpointImplBase.java:1012) at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendStringByCompletion(WsRemoteEndpointImplBase.java:174) at org.apache.tomcat.websocket.WsRemoteEndpointAsync.sendText(WsRemoteEndpointAsync.java:47) -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org