This is an automated email from the ASF dual-hosted git repository. rmaucher pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 60b5bcb0a8bd8f74d80a498416d852f9ad907912 Author: opencode <[email protected]> AuthorDate: Sat Oct 17 12:57:55 2026 +0200 Fix 32-bit truncation of the WebSocket client I/O timeout The connectToServerRecursive() method read the millisecond value of the org.apache.tomcat.websocket.IO_TIMEOUT_MS user property with Long.valueOf(...).intValue(), silently truncating it to 32 bits. A configured timeout greater than 2^31-1 ms (~24.8 days) was misinterpreted: a value whose low 32 bits are negative (e.g. 30 days) became a negative timeout, causing the subsequent Future.get(timeout, MILLISECONDS) calls for the connection, handshake and request/response steps to fail immediately, while other large values were silently shortened to their low 32 bits. Use longValue(). The value is only ever passed directly to Future.get(long, TimeUnit.MILLISECONDS), so the restored full long range introduces no deadline arithmetic issues, and behaviour for values within the previous int range is unchanged. --- java/org/apache/tomcat/websocket/WsWebSocketContainer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/org/apache/tomcat/websocket/WsWebSocketContainer.java b/java/org/apache/tomcat/websocket/WsWebSocketContainer.java index cda0f24783..b8003cf5f3 100644 --- a/java/org/apache/tomcat/websocket/WsWebSocketContainer.java +++ b/java/org/apache/tomcat/websocket/WsWebSocketContainer.java @@ -280,7 +280,7 @@ public class WsWebSocketContainer implements WebSocketContainer, BackgroundProce long timeout = Constants.IO_TIMEOUT_MS_DEFAULT; String timeoutValue = (String) userProperties.get(Constants.IO_TIMEOUT_MS_PROPERTY); if (timeoutValue != null) { - timeout = Long.valueOf(timeoutValue).intValue(); + timeout = Long.valueOf(timeoutValue).longValue(); } AsynchronousSocketChannel socketChannel; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
