dcramer/sentry — Issue #315: Replay request should handle socket errors
Author: acdha
Created: 2012-01-24 15:10:21+00:00
State: open

I recently changed the hostname for our sentry server and got the following traceback because DNS resolution failed. While this is something of an edge case, the conn.request call should probably have an EnvironmentError except block to gracefully handle low-level network errors.

{{{
gaierror: (-5, 'No address associated with hostname')

Traceback (most recent call last):

File "django/core/handlers/base.py", line 168, in get_response
receivers = signals.got_request_exception.send(sender=self.__class__, request=request)

File "sentry/web/decorators.py", line 61, in wrapped
return func(request, *args, **kwargs)

File "django/utils/decorators.py", line 99, in _wrapped_view
raise

File "sentry/web/frontend/events.py", line 97, in replay_event
headers=form.cleaned_data['headers'],

File "sentry/replays.py", line 27, in replay
conn.request(self.method, urlparts.path, data, self.headers or {})

File "python2.7/httplib.py", line 955, in request
self._send_request(method, url, body, headers)

File "python2.7/httplib.py", line 989, in _send_request
self.endheaders(body)

File "python2.7/httplib.py", line 951, in endheaders
self._send_output(message_body)

File "python2.7/httplib.py", line 811, in _send_output
self.send(msg)

File "python2.7/httplib.py", line 773, in send
self.connect()

File "python2.7/httplib.py", line 754, in connect
self.timeout, self.source_address)

File "eventlet/green/socket.py", line 43, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):

File "eventlet/support/greendns.py", line 174, in getaddrinfo
rrset = resolve(host)

File "eventlet/support/greendns.py", line 133, in resolve
raise socket.gaierror(error)
}}}