-
Notifications
You must be signed in to change notification settings - Fork 166
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
test_heartbeat_timeout.py: reproducer for thread-safety issues in HeartbeatListener #390
base: dev
Are you sure you want to change the base?
Conversation
Reset the "disconnected" variable in the on_connected() method, so wait_on_disconnected() does the right thing when a connection has reconnected.
…rtbeatListener Python sockets are not thread-safe. These tests expose an issue where, in the event of a heartbeat timeout, the heartbeat thread closes the socket while the receiver thread created by the transport is reading from it. This can lead to memory corruption and segmentation faults.
Example output I get when running these tests locally:
|
FYI, local testing doesn't work for me with this one. Goes into a loop and then eventually dumps core. |
That’s the point actually. :) The HeartbeatListener closes the socket from outside the main thread, which leads to memory corruption and core dumps. This test is exposing the problem, I don’t yet have a good solution. No need to merge this yet, I just wanted to call attention to it. Open to suggestions for a fix. |
LOL, yeah sorry I suddenly realised that after I commented and then went to bed. It was a late night senile moment... I'll give it some further as well. Not sure how to resolve either... |
@jasonrbriggs, are there any plans for fixing this? Or at least a way to overcome this issue? |
No plans at the moment. I started working on a rewrite using asyncio (https://github.com/jasonrbriggs/stomp.py/tree/asyncio-experimental), which might have been a solution, but never got it working completely, nor had the time to finish it. |
Python sockets are not thread-safe. These tests expose an issue where, in the event of a heartbeat timeout, the heartbeat thread closes the socket while the receiver thread created by the transport is reading from it. This can lead to memory corruption and segmentation faults. Related to #389 .