When a web socket close message has been sent JBoss Web should tear down the underlying TCP connection, however this does not actually happen. Even though the ServletOutputStream is closed, this close call does not close the underlying socket.
There's a discrepancy with Tomcat's handling, so I'll try to resolve it.
Tried to align the behavior in r2415.
The current code still does not work. I think that when an update is present the keepAlive field in org.apache.coyote.http11.Http11AbstractProcessor must be set to false. I did up a quick patch that set this to false if the upgrade header is present, and it appears to work. Not 100% sure if this is the best solution though. Index: src/main/java/org/apache/coyote/http11/Http11NioProcessor.java =================================================================== --- src/main/java/org/apache/coyote/http11/Http11NioProcessor.java (revision 2415) +++ src/main/java/org/apache/coyote/http11/Http11NioProcessor.java (working copy) @@ -1228,6 +1228,10 @@ keepAlive = false; } + if(headers.getHeader("Upgrade") != null) { + keepAlive = false; + } + // If we know that the request is bad this early, add the // Connection: close header. keepAlive = keepAlive && !statusDropsConnection(statusCode);
This doesn't look very good to me. I want to do a clean close, if it doesn't work, well ...
From what I can see the code you added does not do a clean close, it simply starts the next request processing, which does not really make sense, you should not be trying to parse a HTTP request on an upgraded connection. As far as I can tell setting keepAlive to false tells the server to not start processing the next request, but cleanly close the connection instead, which is exactly the behaviour that is expected.
Yes, there needs to be some code to avoid doing a keepalive after upgrade. This is all Servlet 3.1 but not really tested obviously.
The processing of the close now seems more appropriate, but need to make sure this does not go into keepalive (as with the diff above basically): r2416
The last commit fixes the issue.
Ok, so it will be in the next web build.
Included with https://bugzilla.redhat.com/show_bug.cgi?id=1100799
Verified in EAP 6.3.0.ER7