This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 7.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/7.0.x by this push: new 53f104f Log additional information when a WebSocket connection fails 53f104f is described below commit 53f104ffd2e701a2a74500f690725c36b5e08217 Author: Mark Thomas <ma...@apache.org> AuthorDate: Wed Jul 8 21:42:42 2020 +0100 Log additional information when a WebSocket connection fails This is primarily to help debug a relatively rare CI failure in TestWebSocketFrameClient.testConnectToRootEndpoint() --- java/org/apache/tomcat/websocket/LocalStrings.properties | 1 + java/org/apache/tomcat/websocket/WsWebSocketContainer.java | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/java/org/apache/tomcat/websocket/LocalStrings.properties b/java/org/apache/tomcat/websocket/LocalStrings.properties index 0659225..0888576 100644 --- a/java/org/apache/tomcat/websocket/LocalStrings.properties +++ b/java/org/apache/tomcat/websocket/LocalStrings.properties @@ -132,6 +132,7 @@ wsWebSocketContainer.pathNoHost=No host was specified in URI wsWebSocketContainer.pathWrongScheme=The scheme [{0}] is not supported. The supported schemes are ws and wss wsWebSocketContainer.proxyConnectFail=Failed to connect to the configured Proxy [{0}]. The HTTP response code was [{1}] wsWebSocketContainer.redirectThreshold=Cyclic Location header [{0}] detected / reached max number of redirects [{1}] of max [{2}] +wsWebSocketContainer.responseFail=The HTTP upgrade to WebSocket failed but partial data may have been received: Status Code [{0}], HTTP headers [{1}] wsWebSocketContainer.sessionCloseFail=Session with ID [{0}] did not close cleanly wsWebSocketContainer.sslEngineFail=Unable to create SSLEngine to support SSL/TLS connections wsWebSocketContainer.unsupportedAuthScheme=Failed to handle HTTP response code [{0}]. Unsupported Authentication scheme [{1}] returned in response diff --git a/java/org/apache/tomcat/websocket/WsWebSocketContainer.java b/java/org/apache/tomcat/websocket/WsWebSocketContainer.java index b4cbe34..a59296c 100644 --- a/java/org/apache/tomcat/websocket/WsWebSocketContainer.java +++ b/java/org/apache/tomcat/websocket/WsWebSocketContainer.java @@ -858,9 +858,17 @@ public class WsWebSocketContainer response.clear(); // Blocking read Future<Integer> read = channel.read(response); - Integer bytesRead = read.get(timeout, TimeUnit.MILLISECONDS); + Integer bytesRead; + try { + bytesRead = read.get(timeout, TimeUnit.MILLISECONDS); + } catch (TimeoutException e) { + TimeoutException te = new TimeoutException( + sm.getString("wsWebSocketContainer.responseFail", Integer.toString(status), headers)); + te.initCause(e); + throw te; + } if (bytesRead.intValue() == -1) { - throw new EOFException(); + throw new EOFException(sm.getString("wsWebSocketContainer.responseFail", Integer.toString(status), headers)); } response.flip(); while (response.hasRemaining() && !readHeaders) { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org