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 2023/06/07 12:51:13 UTC
[tomcat] branch 9.0.x updated: Improve error handling
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 300a482b62 Improve error handling
300a482b62 is described below
commit 300a482b62988140cd7b86fa2d64f2f7dad43f2a
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Jun 7 13:50:25 2023 +0100
Improve error handling
Should address recent intermittent CI failures for some WebSocket tests
(at least it does on my laptop that exhibited the same failures)
---
java/org/apache/tomcat/websocket/server/WsFrameServer.java | 3 ++-
webapps/docs/changelog.xml | 8 ++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/java/org/apache/tomcat/websocket/server/WsFrameServer.java b/java/org/apache/tomcat/websocket/server/WsFrameServer.java
index fd4da3d44a..c0eb9e8b62 100644
--- a/java/org/apache/tomcat/websocket/server/WsFrameServer.java
+++ b/java/org/apache/tomcat/websocket/server/WsFrameServer.java
@@ -73,7 +73,8 @@ public class WsFrameServer extends WsFrameBase {
inputBuffer.position(inputBuffer.limit()).limit(inputBuffer.capacity());
int read = socketWrapper.read(false, inputBuffer);
inputBuffer.limit(inputBuffer.position()).reset();
- if (read < 0) {
+ // Some error conditions in NIO2 will trigger a return of zero and close the socket
+ if (read < 0 || socketWrapper.isClosed()) {
throw new EOFException();
} else if (read == 0) {
return;
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index f60001fc8c..f72cf7ac37 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -114,6 +114,14 @@
</fix>
</changelog>
</subsection>
+ <subsection name="WebSocket">
+ <changelog>
+ <fix>
+ Improve handling of error conditions for the WebSocket server,
+ particularly during Tomcat shutdown. (markt)
+ </fix>
+ </changelog>
+ </subsection>
</section>
<section name="Tomcat 9.0.76 (remm)" rtext="release in progress">
<subsection name="Catalina">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org