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

Race condition present somewhere in receive() #18

Closed
bxdn opened this issue Aug 24, 2022 · 2 comments
Closed

Race condition present somewhere in receive() #18

bxdn opened this issue Aug 24, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@bxdn
Copy link

bxdn commented Aug 24, 2022

When testing flask-sock, I ran into an issue where I wasn't getting a ConnectionClosed exception when the client closes the connection (using None timeout). In fact, as it appears that as self.connected is not being toggled, the resulting behavior is that the loop is entered for one more iteration, and my server hangs indefinitely attempting to receive.

I traced it here. Adding a sleep before the event clear makes it work properly, but is obviously a hack.

Edit: It appears that just using a timeout solves the problem. However, you might still want to look at this so I'll keep everything up.

@miguelgrinberg
Copy link
Owner

@bxdn I'm unable to reproduce this race condition here, but I think I have found the problem anyway. Can I ask you to install the main branch of this package and retest? Thanks!

@miguelgrinberg miguelgrinberg added the bug Something isn't working label Aug 24, 2022
@miguelgrinberg miguelgrinberg self-assigned this Aug 24, 2022
miguelgrinberg added a commit that referenced this issue Aug 24, 2022

Verified

This commit was signed with the committer’s verified signature.
miguelgrinberg Miguel Grinberg
@bxdn
Copy link
Author

bxdn commented Aug 24, 2022

That worked beautifully on my end, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants