Web Socket:气氛推送太多数据错误[TEXT_FULL_WRITING]

时间:2017-11-23 08:49:50

标签: sockets atmosphere atmosphere.js

我正在使用氛围来将数据从tomcat服务器传输到客户端,并使用javascript编写,并开发了一个实现WebSocketStreamingHandlerAdapter的weksocket通道。我发送了大约10000条消息的消息,消息类似于:

{"eventName":"bubleLayer","message":{"SHAPE":"POINT (-12048311.6244 5329789.155)","geoType":"POINT","TIMESTAMP":"2015-08-05 23:49:23.0","ID":"43.11694574","VALUE":37.02476501464844}}

问题是,当我在我的localhost上测试框架时,所有10000条消息都被推送到我的客户端,但是,我们在推送5000条消息后远程访问应用程序,它会收到此错误:

java.io.IOException: Socket closed
at org.atmosphere.container.version.JSR356WebSocket.write(JSR356WebSocket.java:75)
at StreamQueryService.pushResultToSocket(StreamQueryService.java:123)
at StreamQueryService.processResultSet(StreamQueryService.java:107)
at StreamQueryService.runFirstLoad(StreamQueryService.java:96)
at StreamQueryService.handleStreamingQuery(StreamQueryService.java:66)
at rg.atmosphere.websocket.DefaultWebSocketProcessor.notifyListener(DefaultWebSocketProcessor.java:747)
at org.atmosphere.websocket.DefaultWebSocketProcessor.invokeWebSocketProtocol(DefaultWebSocketProcessor.java:470)
at org.atmosphere.container.JSR356Endpoint$3.onMessage(JSR356Endpoint.java:246)
at org.atmosphere.container.JSR356Endpoint$3.onMessage(JSR356Endpoint.java:243)
at org.apache.tomcat.websocket.WsFrameBase.sendMessageText(WsFrameBase.java:394)
at org.apache.tomcat.websocket.server.WsFrameServer.sendMessageText(WsFrameServer.java:119)
at org.apache.tomcat.websocket.WsFrameBase.processDataText(WsFrameBase.java:495)
at org.apache.tomcat.websocket.WsFrameBase.processData(WsFrameBase.java:294)
at org.apache.tomcat.websocket.WsFrameBase.processInputBuffer(WsFrameBase.java:133)
at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:82)
at org.apache.tomcat.websocket.server.WsFrameServer.doOnDataAvailable(WsFrameServer.java:171)
at org.apache.tomcat.websocket.server.WsFrameServer.notifyDataAvailable(WsFrameServer.java:151)
at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.upgradeDispatch(WsHttpUpgradeHandler.java:148)
at org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch(UpgradeProcessorInternal.java:54)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:53)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1457)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)

然后推送了几条消息,然后我看到了这个错误:

00:22:24.306 [http-nio-8080-exec-4] DEBUG o.a.w.DefaultWebSocketProcessor - Listener error {}
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:1224) ~[tomcat-websocket.jar:8.5.20]
at org.apache.tomcat.websocket.WsRemoteEndpointImplBase$StateMachine.textStart(WsRemoteEndpointImplBase.java:1187) ~[tomcat-websocket.jar:8.5.20]
at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendStringByCompletion(WsRemoteEndpointImplBase.java:209) ~[tomcat-websocket.jar:8.5.20]
at org.apache.tomcat.websocket.WsRemoteEndpointAsync.sendText(WsRemoteEndpointAsync.java:47) ~[tomcat-websocket.jar:8.5.20]
at org.atmosphere.container.version.JSR356WebSocket.write(JSR356WebSocket.java:73) ~[atmosphere-runtime-2.4.2.jar:2.4.2]
at StreamQueryService.pushResultToSocket(StreamQueryService.java:123) ~[classes/:na]
at StreamQueryService.processResultSet(StreamQueryService.java:107) ~[classes/:na]
at StreamQueryService.runFirstLoad(StreamQueryService.java:96) ~[classes/:na]
at StreamQueryService.handleStreamingQuery(StreamQueryService.java:66) ~[classes/:na]
at websocket.StreamingModelChannel$1.onMessage(StreamingModelChannel.java:61) ~[classes/:na]
at org.atmosphere.websocket.DefaultWebSocketProcessor.notifyListener(DefaultWebSocketProcessor.java:747) [atmosphere-runtime-2.4.2.jar:2.4.2]
at org.atmosphere.websocket.DefaultWebSocketProcessor.invokeWebSocketProtocol(DefaultWebSocketProcessor.java:470) [atmosphere-runtime-2.4.2.jar:2.4.2]
at org.atmosphere.container.JSR356Endpoint$3.onMessage(JSR356Endpoint.java:246) [atmosphere-runtime-2.4.2.jar:2.4.2]
at org.atmosphere.container.JSR356Endpoint$3.onMessage(JSR356Endpoint.java:243) [atmosphere-runtime-2.4.2.jar:2.4.2]
at org.apache.tomcat.websocket.WsFrameBase.sendMessageText(WsFrameBase.java:394) [tomcat-websocket.jar:8.5.20]
at org.apache.tomcat.websocket.server.WsFrameServer.sendMessageText(WsFrameServer.java:119) [tomcat-websocket.jar:8.5.20]
at org.apache.tomcat.websocket.WsFrameBase.processDataText(WsFrameBase.java:495) [tomcat-websocket.jar:8.5.20]
at org.apache.tomcat.websocket.WsFrameBase.processData(WsFrameBase.java:294) [tomcat-websocket.jar:8.5.20]
at org.apache.tomcat.websocket.WsFrameBase.processInputBuffer(WsFrameBase.java:133) [tomcat-websocket.jar:8.5.20]
at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:82) [tomcat-websocket.jar:8.5.20]
at org.apache.tomcat.websocket.server.WsFrameServer.doOnDataAvailable(WsFrameServer.java:171) [tomcat-websocket.jar:8.5.20]
at org.apache.tomcat.websocket.server.WsFrameServer.notifyDataAvailable(WsFrameServer.java:151) [tomcat-websocket.jar:8.5.20]
at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.upgradeDispatch(WsHttpUpgradeHandler.java:148) [tomcat-websocket.jar:8.5.20]
at org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch(UpgradeProcessorInternal.java:54) [tomcat-coyote.jar:8.5.20]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:53) [tomcat-coyote.jar:8.5.20]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-coyote.jar:8.5.20]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1457) [tomcat-coyote.jar:8.5.20]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:8.5.20]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.5.20]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]

任何帮助表示赞赏!

0 个答案:

没有答案