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

Avoid deadlock when disposing serial connection #1443

Merged
merged 4 commits into from
Jun 30, 2023

Conversation

glopesdev
Copy link
Member

@glopesdev glopesdev commented Jun 30, 2023

This PR resolves concurrency issues around dynamic disposal of serial port connections, especially involving contention and locking inside reactive combinators. The current implementation relies on shared locking of the base stream to implement at-least-once semantics for closing the serial port.

It is unfortunately not ideal in that it does not completely guarantee synchronous disposal of the resource. To do this for all edge-cases would require reimplementing the callback logic in the SerialPort class or reimplement the serial port observable using polling via a dedicated service thread.

Fixes #1437

@glopesdev glopesdev added the fix Pull request that fixes an issue label Jun 30, 2023
@glopesdev glopesdev added this to the 2.8 milestone Jun 30, 2023
@glopesdev glopesdev merged commit f100b8c into bonsai-rx:main Jun 30, 2023
2 checks passed
@glopesdev glopesdev deleted the issue-1437 branch June 30, 2023 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Pull request that fixes an issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deadlock when disposing high-frequency serial stream
1 participant