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

Deadlock when accessing channel state #356

Open
matthiasgeihs opened this issue Jul 2, 2022 · 0 comments
Open

Deadlock when accessing channel state #356

matthiasgeihs opened this issue Jul 2, 2022 · 0 comments
Labels
bug Something isn't working enhancement Improvement of an existing feature proposal This is not a worked out concept yet.

Comments

@matthiasgeihs
Copy link
Contributor

Location

package channel

Problem

When accessing the state of a channel, one must be careful not to do this while another channel operation (e.g., an update) is happening concurrently, as the result will be a deadlock. (For example, when using the OnUpdate handler, one must not access the channel state from within the handler as the channel mutex is still locked.) Such deadlock instances are easy to run into and can be very hard to debug.

Proposal

It would be nice if we can access the channel state at any time, except when the internals actually are about to modify the state. At the moment the mutex is held throughout the whole update operation, for example. Also we should consider to return a copy of the state, and not a pointer, to ensure that we cannot alter the internal state from an external location.

@matthiasgeihs matthiasgeihs added bug Something isn't working enhancement Improvement of an existing feature proposal This is not a worked out concept yet. labels Jul 2, 2022
@matthiasgeihs matthiasgeihs pinned this issue Jul 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement Improvement of an existing feature proposal This is not a worked out concept yet.
Projects
None yet
Development

No branches or pull requests

1 participant