Skip to content

Handle shutdown exits in gen_statem:call/3#388

Merged
michaelklishin merged 1 commit intomainfrom
md-handle-shutdown-genstatem-call
Jul 17, 2023
Merged

Handle shutdown exits in gen_statem:call/3#388
michaelklishin merged 1 commit intomainfrom
md-handle-shutdown-genstatem-call

Conversation

@the-mikedavis
Copy link
Copy Markdown
Collaborator

Proposed Changes

gen_statem:call/3 can fail if the server shuts down before replying to the call, exiting with {shutdown, Location}. We can handle this exit like the other exits in the gen_statem_safe_call/3. I think it makes sense to return {error, noproc} in this case since it's effectively the same as the server not being alive, but I think an {error, shutdown} return could be ok as well.

Types of Changes

What types of changes does your code introduce to this project?
Put an x in the boxes that apply

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Cosmetics

Checklist

Put an x in the boxes that apply. You can also fill these out after creating
the PR. If you're unsure about any of them, don't hesitate to ask on the
mailing list. We're here to help! This is simply a reminder of what we are
going to look for before merging your code.

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • All tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in related repositories

@michaelklishin
Copy link
Copy Markdown
Contributor

I like the shutdown one better. noproc more or less never means an intended return value, or at least some people automatically expect it to indicate an unhandled error. WDYT?

@the-mikedavis
Copy link
Copy Markdown
Collaborator Author

Yeah that sounds good to me. noproc is also a little different than shutdown here since the server did actually receive the command with shutdown, so let's go with shutdown.

@the-mikedavis the-mikedavis force-pushed the md-handle-shutdown-genstatem-call branch from 06a4b1f to 3e7e199 Compare July 17, 2023 18:21
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.

2 participants