Skip to content

Logs fill with unnecessary stack traces when using SockJS streaming transports [SPR-11438] #16064

@spring-projects-issues

Description

@spring-projects-issues

Prashant Deva opened SPR-11438 and commented

We are using websockets on tomcat 7.0.50 with an in memory simple spring broker.
Our logs are littered with this exception

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 

Either:

  1. This is a bug in spring, in which case fix it
  2. This is expected behavior, in which case provide a workaround/documentation for it so our logs are not littered by it.

Either way, this behavior is not documented and presence of this issue makes logs very, very heavy. Not to mention we don't know if this is an actual error in our app or one we can ignore.

Either fix this issue or provide an explanation/documentation for it.


Affects: 4.0.1

Reference URL: http://stackoverflow.com/questions/21802969/spring-4-websockets-causing-tons-of-exceptions

Issue Links:

0 votes, 7 watchers

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions