Skip to content

Ensure actors de-register with arbiter when cancelled during infitinite streaming.#143

Merged
guilledk merged 12 commits intomasterfrom
ensure_deregister
Aug 4, 2020
Merged

Ensure actors de-register with arbiter when cancelled during infitinite streaming.#143
guilledk merged 12 commits intomasterfrom
ensure_deregister

Conversation

@goodboy
Copy link
Copy Markdown
Owner

@goodboy goodboy commented Aug 3, 2020

This is a (finally) reproduction of the issue I discovered manually in #141; it was likely a regression (caused by #128) but it's hard to know since we didn't have tests for this until now 😄

It turns out the issue only appears if you are in the middle of consuming and infinite stream and are cancelled.
The cancellation causes the trio.Process backend to kill the process before it can cleanup resulting in stale entries in the arbiter registry.

This first set of commits will demonstrate the issue (that I want to see also in CI) and then I will push up the solution commit 🏄

@goodboy goodboy requested a review from guilledk August 3, 2020 22:51
@goodboy
Copy link
Copy Markdown
Owner Author

goodboy commented Aug 3, 2020

Alright there's the expected failures.
Pushing up the fix 😸

Trio will kill subprocesses via `Process.__aexit__()` using a `finally:`
block (which, yes, will get triggered on cancellation) so we avoid that
until true process "tear down" since subactors do many things during
graceful shutdown (such as de-registering from the name discovery
system). Oddly this only seems to be an issue during cancellation of
infinite stream consumption.

Resolves #141
@goodboy
Copy link
Copy Markdown
Owner Author

goodboy commented Aug 4, 2020

@guilledk just waiting for your "ok" I think 👍

Copy link
Copy Markdown
Collaborator

@guilledk guilledk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small nitpick hehe

@goodboy
Copy link
Copy Markdown
Owner Author

goodboy commented Aug 4, 2020

@ryanhiebert @guilledk appreciate the review when ready :)

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.

3 participants