Bug 1103596

Summary: WebSocket using NIO2 doesn't properly close connections after certain errors
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Radim Hatlapatka <rhatlapa>
Component: WebAssignee: Rémy Maucherat <rmaucher>
Status: CLOSED CURRENTRELEASE QA Contact: Radim Hatlapatka <rhatlapa>
Severity: urgent Docs Contact: Russell Dickenson <rdickens>
Priority: unspecified    
Version: 6.3.0CC: kkhan, myarboro
Target Milestone: ER6   
Target Release: EAP 6.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-28 15:31:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1104206    
Bug Blocks:    
Attachments:
Description Flags
jstack of EAP
none
The server errors
none
simple websocket endpoint
none
full server log with debug enabled for websockets and connectors none

Description Radim Hatlapatka 2014-06-02 07:38:17 UTC
Created attachment 901366 [details]
jstack of EAP

Description of problem:
WebSocket: On server can some connection remain open consuming CPU load even though client part already finished. I am attaching thread dump of EAP server (This could be related to BZ#1100486, but I am running it with JBossWeb 7.4.4.Final which contains the fix).


Version-Release number of selected component (if applicable):
EAP 6.3.0.ER5 also with updated JBossWeb to 7.4.4.Final


How reproducible: mostly


Steps to Reproduce:
1. enable NIO2 connector (requires JAVA 1.7)
2. deploy app with some websocket endpoint (I am attaching one you can use)
3. do websocket operations resulting in the errors visible in attached logs (for me the easiest is to run autobahn testsuite)
4. check CPU load and running threads

Actual results:
Connections remain open with state waiting for condition (see jstack in attachment)


Expected results:
Connections are properly closed

Additional info:
when I am using APR connector instead of NIO2 it works as expected.

Comment 1 Radim Hatlapatka 2014-06-02 07:40:25 UTC
Created attachment 901368 [details]
The server errors

Server errors, you can see matching connection names between the stacktraces and thread dump.

Comment 2 Radim Hatlapatka 2014-06-02 07:42:22 UTC
Created attachment 901369 [details]
simple websocket endpoint

Simple websocket endpoint which just echos the received message plus logs websocket onError messages.

Comment 3 Radim Hatlapatka 2014-06-02 07:43:20 UTC
Created attachment 901370 [details]
full server log with debug enabled for websockets and connectors

Comment 5 Radim Hatlapatka 2014-06-02 09:30:47 UTC
Note: The number of threads managing opened connections and CPU load increases after the execution finished, the client is no longer running.

Comment 6 Rémy Maucherat 2014-06-02 16:04:26 UTC
Avoiding the loop seems possible (r2435), but the main problem is not fixed.

Comment 9 Radim Hatlapatka 2014-06-10 07:14:15 UTC
I am no longer seeing this error with EAP 6.3.0.ER7, verified.