Skip to content

Commit 2f8bd83

Browse files
authored
Ignore the gunicorn errors that handle client request issues (pypi#4570)
1 parent 6724be5 commit 2f8bd83

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

tests/unit/test_raven.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,23 @@ def __init__(self):
112112
include_paths=["warehouse"],
113113
release="blargh",
114114
transport="the transport",
115-
ignore_exceptions=[SystemExit],
115+
ignore_exceptions=[
116+
SystemExit,
117+
"gunicorn.http.errors.ParseException",
118+
"gunicorn.http.errors.NoMoreData",
119+
"gunicorn.http.errors.InvalidRequestLine",
120+
"gunicorn.http.errors.InvalidRequestMethod",
121+
"gunicorn.http.errors.InvalidHTTPVersion",
122+
"gunicorn.http.errors.InvalidHeader",
123+
"gunicorn.http.errors.InvalidHeaderName",
124+
"gunicorn.http.errors.InvalidChunkSize",
125+
"gunicorn.http.errors.ChunkMissingTerminator",
126+
"gunicorn.http.errors.LimitRequestLine",
127+
"gunicorn.http.errors.LimitRequestHeaders",
128+
"gunicorn.http.errors.InvalidProxyLine",
129+
"gunicorn.http.errors.ForbiddenProxyRequest",
130+
"gunicorn.http.errors.InvalidSchemeHeaders",
131+
],
116132
)
117133
]
118134
assert config.registry["raven.client"] is client_obj

warehouse/raven.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,34 @@ def includeme(config):
6161
# of OpenSSL generating a SIGABRT when OpenSSL_Die() is called, and then
6262
# Gunicorn treating that as being told to exit the process. Either way, there
6363
# isn't anything we can do about them, so they just cause noise.
64-
ignore_exceptions=[SystemExit],
64+
ignore_exceptions=[
65+
# For some reason we get periodic SystemExit exceptions, I think it is
66+
# because of OpenSSL generating a SIGABRT when OpenSSL_Die() is called, and
67+
# then Gunicorn treating that as being told to exit the process. Either way,
68+
# there isn't anything we can do about them, so they just cause noise.
69+
SystemExit,
70+
# Gunicorn internally raises these errors, and will catch them and handle
71+
# them correctly... however they have to first pass through our WSGI
72+
# middleware for Raven which is catching them and logging them. Instead we
73+
# will ignore them.
74+
# We have to list these as strings, and list all of them because we don't
75+
# want to import Gunicorn in our application, and when using strings Raven
76+
# doesn't handle inheritence.
77+
"gunicorn.http.errors.ParseException",
78+
"gunicorn.http.errors.NoMoreData",
79+
"gunicorn.http.errors.InvalidRequestLine",
80+
"gunicorn.http.errors.InvalidRequestMethod",
81+
"gunicorn.http.errors.InvalidHTTPVersion",
82+
"gunicorn.http.errors.InvalidHeader",
83+
"gunicorn.http.errors.InvalidHeaderName",
84+
"gunicorn.http.errors.InvalidChunkSize",
85+
"gunicorn.http.errors.ChunkMissingTerminator",
86+
"gunicorn.http.errors.LimitRequestLine",
87+
"gunicorn.http.errors.LimitRequestHeaders",
88+
"gunicorn.http.errors.InvalidProxyLine",
89+
"gunicorn.http.errors.ForbiddenProxyRequest",
90+
"gunicorn.http.errors.InvalidSchemeHeaders",
91+
],
6592
)
6693
config.registry["raven.client"] = client
6794

0 commit comments

Comments
 (0)