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

[REF-3184] [REF-3339] Background task locking improvements #3696

Merged
merged 4 commits into from
Jul 23, 2024

Conversation

masenf
Copy link
Collaborator

@masenf masenf commented Jul 22, 2024

  • Raise ImmutableStateError if attempting to enter async with self while the lock is already held
  • When accessing other states via get_state, share the same StateProxy context, lock, and mutability flag. (If a coroutine in the other state attempts async with self this will now fail due to the change above.

Due to how locking is implemented in redis, modifying a substate separately from the entire state tree is not possible, because there is a single lock for a given client_token state and all substates.

Fix #3554

masenf added 2 commits July 22, 2024 13:02
… blocks

Avoid deadlock when the background task already holds the mutation lock for a
given state.
When calling `get_state` from a background task, the resulting state instance
is wrapped in a StateProxy that is bound to the original StateProxy and shares
the same async context, lock, and mutability flag.
@masenf masenf merged commit 0845d2e into main Jul 23, 2024
47 checks passed
@masenf masenf deleted the masenf/background-task-fixes branch July 23, 2024 22:28
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.

[REF-3184] All my rx.background don't work on 0.5.5
2 participants