You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2015/03/26 01:32:07 UTC
[Bug 57762] New: WebSocket client doesn't detect forceful connection
failures
https://bz.apache.org/bugzilla/show_bug.cgi?id=57762
Bug ID: 57762
Summary: WebSocket client doesn't detect forceful connection
failures
Product: Tomcat 8
Version: 8.0.20
Hardware: PC
OS: Mac OS X 10.1
Status: NEW
Severity: normal
Priority: P2
Component: WebSocket
Assignee: dev@tomcat.apache.org
Reporter: palmercox@gmail.com
It appears that the WebSocket client can't detect when a connection is
forcefully closed. Given the following example program:
public class App2 {
@ClientEndpoint
public static class Client {
@OnClose
public void onClose() {
System.out.println("CLOSED");
}
@OnError
public void onError(Throwable t) {
System.out.println("ERROR: " + t);
}
}
public static void main(final String[] args) throws Exception {
final WebSocketContainer container =
ContainerProvider.getWebSocketContainer();
System.out.println("Container: " + container);
container.connectToServer(
Client.class,
URI.create("ws://echo.websocket.org/"));
Thread.sleep(Long.MAX_VALUE);
}
}
I then modified /etc/hosts so that echo.websocket.org resolved to localhost. I
then set up an SSH tunnel to direct local port 80 to echo.websocket.org (which
is 174.129.224.73):
sudo ssh me@someserver -L 80:174.129.224.73:80
I then started the program. It connected. Next, I killed the SSH session.
Neither the onClosed on onError methods were invoked.
When I tested the same program running on Tyrus 1.10, however, onClose was
invoked with a CloseReason 10006 - Closed Abnormally.
I think the Tyrus behavior is correct - the socket is dead and the program
should be notified.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 57762] WebSocket client doesn't detect forceful connection
failures
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57762
Mark Thomas <ma...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
OS| |All
Status|NEW |RESOLVED
--- Comment #4 from Mark Thomas <ma...@apache.org> ---
Interesting. The NIO2 code reports a dropped connection as a successful read
for EOF. Not what was expected. This is now correctly handled in trunk, 8.0.x
(for 8.0.22 onwards) and 7.0.x (for 7.0.62 onwards).
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 57762] WebSocket client doesn't detect forceful connection
failures
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57762
--- Comment #2 from Remy Maucherat <re...@apache.org> ---
The NIO2 code that the client uses looks ok to me (WsFrameClient) and should
work unless there's a JVM or platform issue. If the JVM doesn't report that the
socket is gone using the failed of the completion handler, then nothing is
going to happen and it would be the behavior you see.
Although this should be tested to make sure this is indeed the explanation,
it's possible there's no Tomcat bug to fix here.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 57762] WebSocket client doesn't detect forceful connection
failures
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57762
--- Comment #1 from palmercox@gmail.com ---
I tested this on Tomcat 8.0.20.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 57762] WebSocket client doesn't detect forceful connection
failures
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57762
palmercox@gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
OS|Mac OS X 10.1 |Mac OS X 10.9
--- Comment #3 from palmercox@gmail.com ---
For reference, I tested on Mac OS X 10.10.2 and Java 1.8.0_40. I haven't had a
chance to check if there is a JVM issue.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org