gpt4 book ai didi

java - Spring 4 websockets 导致大量异常

转载 作者:行者123 更新时间:2023-11-28 22:20:40 25 4
gpt4 key购买 nike

自从我们在 Spring 4 中开始使用 websockets 以来,我们的日志中到处都是这个异常:

3 ERROR MessageBrokerSockJS-1 handler.XhrStreamingTransportHandler$XhrStreamingSockJsSession:276 - Terminating connection after failure to send message to client. This may be because the client has gone away (see https://java.net/jira/browse/SERVLET_SPEC-44) 
Feb 15 12:05:16 apmgui i-04e9bc6a: ClientAbortException: java.net.SocketException: Broken pipe
Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:371)
Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:333)
Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.catalina.connector.Response.flushBuffer(Response.java:570)
Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java:307)
Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.http.server.ServletServerHttpResponse.flush(ServletServerHttpResponse.java:81)
Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSession.writeFrameInternal(StreamingSockJsSession.java:99)
Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.writeFrame(AbstractSockJsSession.java:273)
Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.sendHeartbeat(AbstractSockJsSession.java:294)
Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession$1.run(AbstractSockJsSession.java:309)
Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
Feb 15 12:05:16 apmgui i-04e9bc6a: at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
Feb 15 12:05:16 apmgui i-04e9bc6a: at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
Feb 15 12:05:16 apmgui i-04e9bc6a: at java.util.concurrent.FutureTask.run(Unknown Source)
Feb 15 12:05:16 apmgui i-04e9bc6a: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
Feb 15 12:05:16 apmgui i-04e9bc6a: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
Feb 15 12:05:16 apmgui i-04e9bc6a: at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
Feb 15 12:05:16 apmgui i-04e9bc6a: at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
Feb 15 12:05:16 apmgui i-04e9bc6a: at java.lang.Thread.run(Unknown Source)
Feb 15 12:05:16 apmgui i-04e9bc6a: Caused by: java.net.SocketException: Broken pipe
Feb 15 12:05:16 apmgui i-04e9bc6a: at java.net.SocketOutputStream.socketWrite0(Native Method)
Feb 15 12:05:16 apmgui i-04e9bc6a: at java.net.SocketOutputStream.socketWrite(Unknown Source)
Feb 15 12:05:16 apmgui i-04e9bc6a: at java.net.SocketOutputStream.write(Unknown Source)
Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:215)
Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:480)
Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.coyote.http11.InternalOutputBuffer.flush(InternalOutputBuffer.java:119)
Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:805)
Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.coyote.Response.action(Response.java:174)
Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:366)
Feb 15 12:05:16 apmgui i-04e9bc6a: ... 17 more

我们可以做些什么来防止这种情况发生?

最佳答案

现在在 Spring Framework 中对此进行了讨论和跟踪 https://jira.springsource.org/browse/SPR-11438 .

关于java - Spring 4 websockets 导致大量异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21802969/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com