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

SystemExit and KeyboardInterrupt no longer caught (regression from raven-python) #379

Closed
saifelse opened this issue May 30, 2019 · 6 comments · Fixed by #380
Closed

SystemExit and KeyboardInterrupt no longer caught (regression from raven-python) #379

saifelse opened this issue May 30, 2019 · 6 comments · Fixed by #380

Comments

@saifelse
Copy link
Contributor

The same reasoning as getsentry/raven-python#675 applies for sentry-python,
where gunicorn raising a SytemExit(1) is something we would like to capture
in Sentry, as it is unexpected behavior from the application.

saifelse added a commit to benchling/sentry-python that referenced this issue May 30, 2019
…I middleware

Neither SystemExit nor KeyboardInterrupt subclass Exception, so we must
explicitly handle these two exception classes in addition to Exception in the
WSGI middleware.

This is notably a direct port from raven-python:
 - https://github.com/getsentry/raven-python/blob/master/raven/middleware.py
 - https://github.com/getsentry/raven-python/blob/master/tests/middleware/tests.py

Fixes: getsentryGH-379
saifelse added a commit to benchling/sentry-python that referenced this issue May 31, 2019
untitaker pushed a commit that referenced this issue Jun 1, 2019
…rupt (#380)

* Log SystemExit (with non-zero exit code) and KeyboardInterrupt in WSGI middleware

Neither SystemExit nor KeyboardInterrupt subclass Exception, so we must
explicitly handle these two exception classes in addition to Exception in the
WSGI middleware.

This is notably a direct port from raven-python:
 - https://github.com/getsentry/raven-python/blob/master/raven/middleware.py
 - https://github.com/getsentry/raven-python/blob/master/tests/middleware/tests.py

Fixes: GH-379
@WhyNotHugo
Copy link

Huh, I've the opposite issue: raven did not log this, but the new client does.
However, I don't want this logged, since it doesn't make sense to me (the system will exit on every deployment, and that can happen way too many times).

Is there any way to avoid logging SystemExit? It doesn't make sense to me, and is filling my sentry issues board.

@untitaker
Copy link
Member

@WhyNotHugo can you confirm those events have the wsgi mechanism?

@WhyNotHugo
Copy link

Yes, they all do.

@untitaker
Copy link
Member

Hmm, from what I know this means you abort gunicorn while it is handling a request and that might be the wrong way to shut it down.

In any case you can explicitly ignore this error like any error class with this here: #149 (comment)

@WhyNotHugo
Copy link

Hmmm... let me double check, I believe we're killing gunicorn gracefully, but I might be wrong.

@WhyNotHugo
Copy link

Yeah, looks like docker was killing them before gunicorn's internal grace period, I'll tweak that and it should solve it for me. Thanks.

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 a pull request may close this issue.

3 participants