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

Re-enable app shutdown actions #6244

Merged
merged 3 commits into from
Apr 19, 2024
Merged

Conversation

lstein
Copy link
Collaborator

@lstein lstein commented Apr 19, 2024

Summary

PR #6026, which was introduced to allow for ^C interruption during long model loading sequences at startup time, inadvertently interferes with the applications shutdown event from firing correctly (see #6242). The original PR was written to address an issue with the scan_models_on_startup behavior. When using the in-memory database, scan_models_on_startup, which defaulted to True, would take a long time to compute the blake3 hash of each model in the models directory. Because of the ASGI application's sigINT handling, this process was uninterruptable, and very painful to wait through. However, more recently scan_models_on_startup defaults to False, and this is not so much of an issue.

The code in this PR temporarily disables ASGI sigINT handling just before model scanning starts and reenables it right after, using a context manager. This will allow user who have scan_models_on_startup set to True to interrupt the program without interfering with routine shutdown handling.

Related Issues / Discussions

QA Instructions

Follow the recipe in #6242 to enable a print statement when the application shuts down. Launch the app, wait for it to settle down, then hit ^C. You should see the print statement output.

Merge Plan

Merge when approved.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Documentation added / updated (if applicable)

@github-actions github-actions bot added python PRs that change python files backend PRs that change backend files services PRs that change app services labels Apr 19, 2024
@lstein lstein added the bug Something isn't working label Apr 19, 2024
Copy link
Collaborator

@psychedelicious psychedelicious left a comment

Choose a reason for hiding this comment

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

Thanks for the quick fix! Tested and confirmed cleanup is happening now.

In the next release, we'll need to communicate to users that we fixed a bug that was preventing unused tensors and files from accumulating, and direct user on how to delete those temp files.

@lstein lstein merged commit 2b9f06d into main Apr 19, 2024
14 checks passed
@lstein lstein deleted the lstein/bugfix/catch-sigint-nicely branch April 19, 2024 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend PRs that change backend files bug Something isn't working python PRs that change python files services PRs that change app services
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug]: app shutdown handler not being called
2 participants