Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http: Fix threading issue causing duplicate WS messages #1127

Merged
merged 1 commit into from
Apr 14, 2015

Conversation

adamcik
Copy link
Member

@adamcik adamcik commented Apr 14, 2015

The problem presents itself when a JSON-RPC call triggers some event in core.
When this happens we have a thread outside of Tornado call write_message
interleaved with a potentially ongoing write if the JSON-RPC response.

To avoid this we now follow Tornado best practices and add callbacks to the
IOLoop to ensure that there isn't any interleaved access of Tornado state.

The problem presents itself when a JSON-RPC call triggers some event in core.
When this happens we have a thread outside of Tornado call `write_message`
interleaved with a potentially ongoing write if the JSON-RPC response.

To avoid this we now follow Tornado best practices and add callbacks to the
IOLoop to ensure that there isn't any interleaved access of Tornado state.
@kingosticks
Copy link
Member

👍 from me, nice quick fix!

@jodal jodal added this to the v1.0.x milestone Apr 14, 2015
@jodal jodal self-assigned this Apr 14, 2015
@jodal jodal added the A-http Area: HTTP frontend label Apr 14, 2015
jodal added a commit that referenced this pull request Apr 14, 2015
http: Fix threading issue causing duplicate WS messages
@jodal jodal merged commit 577a85b into mopidy:v1.0.x Apr 14, 2015
@adamcik adamcik deleted the fix/broadcast-threading-bug branch May 12, 2015 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-http Area: HTTP frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants