Skip to content

Dont broadcast message in compute_if_present to avoid race condition - #72

Merged
npezza93 merged 1 commit into
mainfrom
bugfix
Aug 13, 2025
Merged

npezza93 merged 1 commit into
mainfrom
bugfix

Conversation

@npezza93

@npezza93 npezza93 commented Aug 13, 2025 •

Copy link
Copy Markdown
Collaborator

Fixes #71

This also fixes a performance regression where we grab more messages than we need to.

The issue here is that in the compute_if_present the broadcast call can take some time and if someone disconnects at the same time it can lead to a deadlock which locks up the thread stops broadcasting. This will move the broadcast out of the block to prevent a deadlock and broadcast it after if it should.

Id really like to add a test to prevent this in the future but it's super tricky so I'll come back later if inspiration hits and tackle it then. For now I've run the example script supplied in #71 to verify it no longer locks up

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

Successfully merging this pull request may close these issues.

SolidCable stops to work after some time

1 participant