You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by mike-jumper <gi...@git.apache.org> on 2016/07/30 05:40:26 UTC

[GitHub] incubator-guacamole-client pull request #43: GUACAMOLE-67: Always clean up t...

GitHub user mike-jumper opened a pull request:

    https://github.com/apache/incubator-guacamole-client/pull/43

    GUACAMOLE-67: Always clean up the connection upon WebSocket error.

    From [GUACAMOLE-67](https://issues.apache.org/jira/browse/GUACAMOLE-67):
    
    > If Tomcat (or another servlet container) encounters a hard, internal I/O error while handling a WebSocket connection, the resulting `IOException` will cause the connection thread to die:
    > 
    > ```
    > 15:39:50.882 [Thread-19] DEBUG o.a.g.w.GuacamoleWebSocketTunnelEndpoint - I/O error prevents further reads.
    > java.io.IOException: java.util.concurrent.ExecutionException: java.io.IOException: Key must be cancelled
    > 	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendPartialString(WsRemoteEndpointImplBase.java:228) ~[tomcat-websocket.jar:8.0.14]
    > 	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendString(WsRemoteEndpointImplBase.java:172) ~[tomcat-websocket.jar:8.0.14]
    > 	at org.apache.tomcat.websocket.WsRemoteEndpointBasic.sendText(WsRemoteEndpointBasic.java:37) ~[tomcat-websocket.jar:8.0.14]
    > 	at org.apache.guacamole.websocket.GuacamoleWebSocketTunnelEndpoint$2.run(GuacamoleWebSocketTunnelEndpoint.java:169) ~[GuacamoleWebSocketTunnelEndpoint$2.class:na]
    > Caused by: java.util.concurrent.ExecutionException: java.io.IOException: Key must be cancelled
    > 	at org.apache.tomcat.websocket.FutureToSendHandler.get(FutureToSendHandler.java:102) ~[tomcat-websocket.jar:8.0.14]
    > 	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendPartialString(WsRemoteEndpointImplBase.java:224) ~[tomcat-websocket.jar:8.0.14]
    > 	... 3 common frames omitted
    > Caused by: java.io.IOException: Key must be cancelled
    > 	at org.apache.coyote.http11.upgrade.NioServletOutputStream.doWriteInternal(NioServletOutputStream.java:84) ~[tomcat-coyote.jar:8.0.14]
    > 	at org.apache.coyote.http11.upgrade.NioServletOutputStream.doWrite(NioServletOutputStream.java:61) ~[tomcat-coyote.jar:8.0.14]
    > 	at org.apache.coyote.http11.upgrade.AbstractServletOutputStream.writeInternal(AbstractServletOutputStream.java:162) ~[tomcat-coyote.jar:8.0.14]
    > 	at org.apache.coyote.http11.upgrade.AbstractServletOutputStream.write(AbstractServletOutputStream.java:129) ~[tomcat-coyote.jar:8.0.14]
    > 	at org.apache.tomcat.websocket.server.WsRemoteEndpointImplServer.onWritePossible(WsRemoteEndpointImplServer.java:99) ~[tomcat-websocket.jar:8.0.14]
    > 	at org.apache.tomcat.websocket.server.WsRemoteEndpointImplServer.doWrite(WsRemoteEndpointImplServer.java:81) ~[tomcat-websocket.jar:8.0.14]
    > 	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.writeMessagePart(WsRemoteEndpointImplBase.java:420) ~[tomcat-websocket.jar:8.0.14]
    > 	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.startMessage(WsRemoteEndpointImplBase.java:311) ~[tomcat-websocket.jar:8.0.14]
    > 	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase$TextMessageSendHandler.write(WsRemoteEndpointImplBase.java:675) ~[tomcat-websocket.jar:8.0.14]
    > 	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendPartialString(WsRemoteEndpointImplBase.java:220) ~[tomcat-websocket.jar:8.0.14]
    > 	... 3 common frames omitted
    > ```
    > 
    > This death is fine, but the code handling that error does not properly invoke `closeConnection()`, thus the associated `GuacamoleTunnel` and `GuacamoleSocket` are not guaranteed to be closed. They will *eventually* close due to timeout, but the lack of further read errors means that internal connection tracking will never realize the connection is closed. Extensions like guacamole-auth-jdbc which track connection activity based on closure will fail to properly record the connection as dead, and will require that the connection be explicitly closed by an admin.
    
    This change adds the missing invocation of `closeConnection()` to the handling of the `IOException` mentioned above.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mike-jumper/incubator-guacamole-client fix-connection-hang

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-guacamole-client/pull/43.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #43
    
----
commit 12abb3c59cf0383619fc8f0bb162433a181e2b82
Author: Michael Jumper <mj...@apache.org>
Date:   2016-07-29T22:47:24Z

    GUACAMOLE-67: Always clean up the connection upon WebSocket error.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-guacamole-client pull request #43: GUACAMOLE-67: Always clean up t...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-guacamole-client/pull/43


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---