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

Threading concerns #457

Open
HunterZ opened this issue Apr 22, 2023 · 2 comments
Open

Threading concerns #457

HunterZ opened this issue Apr 22, 2023 · 2 comments

Comments

@HunterZ
Copy link

HunterZ commented Apr 22, 2023

Is there some documentation on the threading model for IXWebSocket? I had assumed that my message handler registered via ix::WebSocket::setOnMessageCallback() would only get invoked from a background thread, but my application just deadlocked because IXWebSocket invoked it from the same call stack in which I called ix::WebSocket::send().

Uncertainty around which threads might call my message handler means I'm forced to either use a recursive mutex, or to always have my handler spin up a short-lived thread. Ideally IXWebSocket would never invoke the callback from a user thread, but failing that it would be helpful to at least have documentation on what to expect.

Edit: Forgot to provide proof of deadlock:
image

@bsergean
Copy link
Collaborator

Here it looks like you're sending in a closed connection, that could happen for many reasons indeed.

@HunterZ
Copy link
Author

HunterZ commented Apr 26, 2023

Thanks, but that doesn't address my larger set of concerns around threading.

Is writing to a closed connection the only condition which might result in a callback from a user thread instead of the background thread?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants