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

Perform graceful termination on SIGINT or SIGTERM signals #729

Closed
wants to merge 5 commits into from

Conversation

lpsinger
Copy link
Contributor

@lpsinger lpsinger commented Dec 6, 2023

Thank you for helping out! ✨

We really appreciate your commitment to improving Architect

To maintain a high standard of quality in our releases, before merging every pull request we ask that you've completed the following:

  • Forked the repo and created your branch from main
  • Made sure tests pass (run npm it from the repo root)
  • Expanded test coverage related to your changes:
    • Added and/or updated unit tests (if appropriate)
    • Added and/or updated integration tests (if appropriate)
  • Updated relevant documentation:
  • Summarized your changes in changelog.md
  • Linked to any related issues, PRs, etc. below that may relate to, consume, or necessitate these changes

Please also be sure to completed the CLA (if you haven't already).

Learn more about contributing to Architect here.

Thanks again!

}
process.exit(0)
})
import('exit-hook').then(({ asyncExitHook }) => asyncExitHook(end, { wait: 5000 }))
Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I have a number of issues here. We shouldn't be using esm-only modules, as our stuff is, for now, still authored in CJS. import is async, so this is a bit wonky here, and may present some funky / non-deterministic scenarios during testing.

Moreover, we will not be adding any new libraries by Sindre moving forward after his actions during the CJS/ESM debacle. (We'll eventually phase the ones still in use.) Finally, I'm not sure what this is really buying us here, and I'm much more inclined to just attempt to handle signals as necessary (or simply use process.on('exit', fn) if possible).

@ryanblock
Copy link
Member

@lpsinger did you still want to look at this?

@lpsinger
Copy link
Contributor Author

Yes, this is still a serious problem for a project.

@ryanblock
Copy link
Member

Ok! Just in case you missed it from architect/architect#1479 (comment):

process.on('exit', ...), process.on('SIGINT', ...), process.on('SIGTERM', ...) are all assumed to be synchronous operations, whereas sandbox.end() is an asynchronous API (which is what I think folks would expect it to be).

I've got a short window this morning, I'll take a quick look at an implementation in another PR.

@ryanblock
Copy link
Member

#732

@ryanblock ryanblock closed this Mar 27, 2024
@ryanblock
Copy link
Member

Best effort attempt at fixing this (within Arc's scope / capabilities) live in v11.0.8!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants