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

Document the need to catch GracefulExit if handle_signals=True #4414

Closed
webknjaz opened this issue Nov 30, 2019 · 0 comments · Fixed by #7043
Closed

Document the need to catch GracefulExit if handle_signals=True #4414

webknjaz opened this issue Nov 30, 2019 · 0 comments · Fixed by #7043
Labels
documentation Improvements or additions to documentation enhancement good first issue Good for newcomers Hacktoberfest We think it's good for https://hacktoberfest.digitalocean.com/ server

Comments

@webknjaz
Copy link
Member

Long story short

I've been using low-level machinery exposed by aiohttp for my framework.
When I learned about handle_signals=True I started testing it and it turned out that my process always exited with return code 1 on SIGTERM and SIGINT.

This was confusing and I thought that it's a bug. But then, after diving into the code deeper, I realized that with this option enabled, aiohttp binds the corresponding handler to process these signals and the only thing they do is raising GracefulExit (which is a subclass of SystemExit with the return code defaulting to 1).

Turns out that it works but only if one uses aiohttp.web.run_app(). This was the last bit of the puzzle for me: using low-level APIs implies that I mostly don't rely on high-level interfaces and thus have to catch the GracefulExit exception in my own runner code.

So my request here is that this should be documented.

I'm marking this as a "good first issue" so that new contributors could have something easy to start with.

Expected behaviour

Docs clarifying this.

Actual behaviour

Docs don't mention this detail.

Steps to reproduce

N/A

Your environment

N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement good first issue Good for newcomers Hacktoberfest We think it's good for https://hacktoberfest.digitalocean.com/ server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants