Effective October 27, 2012, online and email support for FuseSource products will move to Red Hat support channels. For more information, please see the JIRA Migration to Red Hat FAQ.
As of October 27th, please open all new issues in the Red Hat Customer Portal .
Issue Details (XML | Word | Printable)

Key: MB-1197
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Dejan Bosanac
Reporter: christian posta
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
FUSE Message Broker

Race condition with StompServlet and transport listener for websockets

Created: 31/Jul/12 02:22 PM   Updated: 01/Aug/12 10:57 AM
Component/s: broker
Affects Version/s: 5.6.0-fuse-00-00
Fix Version/s: 5.6.0-fuse-00-00

File Attachments: 1. Text File MB-1197___Race_condition_with_StompServlet_and_transport_listener_for_websockets.patch (6 kB)


External Issue URL: https://issues.apache.org/jira/browse/AMQ-3955


 Description  « Hide
In the StompServlet, when a websocket request comes in, we are starting up the broker's websocket connection when we call listener.onAccept(socket).
Under the covers, it begins a task in a new thread to create the connection, instantiate the transport listener, and set the listener on the transport. However, this is done asynchronously, and when the StompServlet calls listener.onAccept(socket), it immediately returns to the underlying jetty websockets implementation, returning the StompSocket (which as the websocket onTextMessage listener). It seems it's possible the jetty code could call back the onTextMessage listener's onMessage(...) method and expect the StompSocket to process the Stomp message before the steps taken to complete creating the connection from the async listener.onAccept(..) call. This would cause the exception in DEV-4312. I have reproduced, but only in a debugger not with live-running examples. I suspect if the conditions are just right (lock contention, for example) the issue in DEV-4312 could happen in a live system.

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
christian posta added a comment - 31/Jul/12 11:28 PM
Added patch

Dejan Bosanac added a comment - 01/Aug/12 10:57 AM
Fixed at apache trunk. It'll be available in 5.6 release. Thanks for the patch