hi,

The scenario involves a mobile phone switching from wifi to (unstable)
mobile network. The phone looses the connection but the server doesn't seem
aware. Basically the server tries to send a message and blocks the thread
on which this is done. From the logs it seems to take about 15 minutes
before a "java.net.SocketException: Broken pipe" finally occurs.

Is this expected behavior or an issue?

I've seen the websocket-how-to on setting BLOCKING_SEND_TIMEOUT. However I
would have expected a timeout based on the default value of 20 seconds.
Also it says the property is configurable through the WebSocketSession but
for something like this I would expect a global setting. Is there such a
way to do that?

The issue was originally reported here [1]. It's a long thread and might
not add to much more. It's worth pointing out the issue seems to be
reproducible with even 1 phone. Also it could not be reproduced on a
windows server with the same tomcat7 server (7.0.52).

Here is the stack of the the writing thread:

 - java.net.SocketOutputStream.socketWrite0(java.io.FileDescriptor, byte[],
int, int) @bci=0 (Compiled frame; information may be imprecise)
 - java.net.SocketOutputStream.socketWrite(byte[], int, int) @bci=52,
line=113 (Compiled frame)
 - java.net.SocketOutputStream.write(byte[], int, int) @bci=4, line=159
(Compiled frame)
 - org.apache.coyote.http11.upgrade.BioServletOutputStream.doWrite(boolean,
byte[], int, int) @bci=8, line=37 (Compiled frame)
 -
org.apache.coyote.http11.upgrade.AbstractServletOutputStream.writeInternal(byte[],
int, int) @bci=24, line=125 (Compiled frame)
 -
org.apache.coyote.http11.upgrade.AbstractServletOutputStream.write(byte[],
int, int) @bci=16, line=92 (Compiled frame)
 -
org.apache.tomcat.websocket.server.WsRemoteEndpointImplServer.onWritePossible(boolean)
@bci=68, line=94 (Compiled frame)
 -
org.apache.tomcat.websocket.server.WsRemoteEndpointImplServer.doWrite(javax.websocket.SendHandler,
java.nio.ByteBuffer[]) @bci=12, line=81 (Compiled frame)
 -
org.apache.tomcat.websocket.WsRemoteEndpointImplBase.writeMessagePart(org.apache.tomcat.websocket.WsRemoteEndpointImplBase$MessagePart)
@bci=349, line=378 (Compiled frame)
 - org.apache.tomcat.websocket.WsRemoteEndpointImplBase.startMessage(byte,
java.nio.ByteBuffer, boolean, javax.websocket.SendHandler) @bci=99,
line=279 (Compiled frame)
 -
org.apache.tomcat.websocket.WsRemoteEndpointImplBase$TextMessageSendHandler.write()
@bci=97, line=672 (Interpreted frame)
 -
org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendPartialString(java.nio.CharBuffer,
boolean) @bci=43, line=210 (Interpreted frame)
 -
org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendPartialString(java.lang.String,
boolean) @bci=13, line=185 (Interpreted frame)
 -
org.apache.tomcat.websocket.WsRemoteEndpointBasic.sendText(java.lang.String,
boolean) @bci=6, line=49 (Compiled frame)

Rossen

Reply via email to