You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2020/07/08 20:44:49 UTC
[tomcat] branch 8.5.x updated: Log additional information when a
WebSocket connection fails
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push:
new 13a9bb1 Log additional information when a WebSocket connection fails
13a9bb1 is described below
commit 13a9bb1abd2e8895d6bb5c783586c377fc78f099
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 929822d..8c3c505 100644
--- a/java/org/apache/tomcat/websocket/LocalStrings.properties
+++ b/java/org/apache/tomcat/websocket/LocalStrings.properties
@@ -142,6 +142,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 67c507a..98c1a8d 100644
--- a/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
+++ b/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
@@ -800,9 +800,17 @@ public class WsWebSocketContainer implements WebSocketContainer, BackgroundProce
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org