Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Log SystemExit in wsgi middleware when code != 0 #686

Merged
merged 2 commits into from
Nov 13, 2015
Merged

Conversation

mattrobenolt
Copy link
Contributor

SystemExit does not subclass Exception, so we don't catch this.
SystemExit manifests itself (at least) from gunicorn when gunicorn
attempts to gracefully shut down a worker process. See GH-675 for more
background.

Fixes: GH-675

SystemExit does not subclass Exception, so we don't catch this.
SystemExit manifests itself (at least) from gunicorn when gunicorn
attempts to gracefully shut down a worker process. See GH-675 for more
background.

Fixes: GH-675
@dcramer
Copy link
Member

dcramer commented Nov 13, 2015

This might cause some duplicate events, but otherwise seems fine

@mattrobenolt
Copy link
Contributor Author

In what cases do you think it'd cause duplicate events?

@dcramer
Copy link
Member

dcramer commented Nov 13, 2015

If this propagates up to the system hook

@mattrobenolt
Copy link
Contributor Author

Ah, lemme test that out and see what actually happens there. Not sure if the system hook ignores a SystemExit or not. My hunch is "yes", considering these errors weren't getting captured before.

@mattrobenolt
Copy link
Contributor Author

import sys

def hook(*exc_info):
    print 'going down'

sys.excepthook = hook

raise SystemExit(1)

excepthook ignores SystemExit

@mitsuhiko mitsuhiko merged commit 5be739c into master Nov 13, 2015
mitsuhiko added a commit that referenced this pull request Nov 13, 2015
@mitsuhiko
Copy link
Member

Merged and also log KeyboardInterrupt which is currently also not handled. This serves a similar purpose for other servers.

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

Successfully merging this pull request may close these issues.

3 participants