dcramer/raven — Issue #43: Raven never gives up, never gives in, never surrenders?
Author: eykd
Created: 2012-01-26 00:26:14+00:00
State: open

I've been testing raven and sentry out. I have raven set up on a Django site as described in the docs. I accidentally misconfigured SENTRY_SERVERS, putting an incorrect server URL in. I deployed this, and tested a page that was throwing an error. Ever since, Raven has been trying to contact the Sentry server on that incorrect URL--I know this because it's still writing to my error log. I've stopped the Django server, restarted it with correct settings, no effect. Raven keeps going.

I eventually tried reconfiguring the local hosts file and Nginx to redirect the incorrect URL to the correct one. This worked, but Sentry is sending poor Raven a 405 error now, and Raven is retaliating by hitting the URL as frequently as possible. Raven keeps going!

I've pored over the output of `ps`, I've `lsof`'d the error log to see what still has it open (nothing), but I can't figure out what process is still going on.

I really do appreciate that Raven is faithfully trying to send that error message, but dang! He's worse than the Energizer bunny!

Here's a sample of the error log output I'm seeing:

Unable to reach Sentry log server: HTTP Error 405: METHOD NOT ALLOWED (url: http://mysentryserver.example.com/sentry/api/store/, body: )
Traceback (most recent call last):
File "/opt/django/federation/lib/python2.6/site-packages/raven/base.py", line 291, in send
self.send_remote(url=url, data=message, headers=headers)
File "/opt/django/federation/lib/python2.6/site-packages/raven/base.py", line 244, in send_remote
return self.send_http(url, data, headers)
File "/opt/django/federation/lib/python2.6/site-packages/raven/base.py", line 269, in send_http
response = urllib2.urlopen(req, data).read()
File "/usr/lib/python2.6/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.6/urllib2.py", line 397, in open
response = meth(req, response)
File "/usr/lib/python2.6/urllib2.py", line 510, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.6/urllib2.py", line 429, in error
result = self._call_chain(*args)
File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain
result = func(*args)
File "/usr/lib/python2.6/urllib2.py", line 605, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "/usr/lib/python2.6/urllib2.py", line 397, in open
response = meth(req, response)
File "/usr/lib/python2.6/urllib2.py", line 510, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.6/urllib2.py", line 435, in error
return self._call_chain(*args)
File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain
result = func(*args)
File "/usr/lib/python2.6/urllib2.py", line 518, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 405: METHOD NOT ALLOWED
Top level Sentry exception caught - failed creating log record
Unable to reach Sentry log server: HTTP Error 405: METHOD NOT ALLOWED (url: http://mysentryserver.example.com/sentry/api/store/, body: )
Traceback (most recent call last):
File "/opt/django/federation/lib/python2.6/site-packages/raven/handlers/logging.py", line 51, in emit
return self._emit(record)
File "/opt/django/federation/lib/python2.6/site-packages/raven/contrib/django/handlers.py", line 34, in _emit
return super(SentryHandler, self)._emit(record, request=request)
File "/opt/django/federation/lib/python2.6/site-packages/raven/handlers/logging.py", line 87, in _emit
date=date, **kwargs)
File "/opt/django/federation/lib/python2.6/site-packages/raven/contrib/django/__init__.py", line 92, in capture
result = super(DjangoClient, self).capture(event_type, **kwargs)
File "/opt/django/federation/lib/python2.6/site-packages/raven/base.py", line 236, in capture
self.send(**data)
File "/opt/django/federation/lib/python2.6/site-packages/raven/contrib/django/__init__.py", line 112, in send
return super(DjangoClient, self).send(**kwargs)
File "/opt/django/federation/lib/python2.6/site-packages/raven/base.py", line 291, in send
self.send_remote(url=url, data=message, headers=headers)
File "/opt/django/federation/lib/python2.6/site-packages/raven/base.py", line 244, in send_remote
return self.send_http(url, data, headers)
File "/opt/django/federation/lib/python2.6/site-packages/raven/base.py", line 269, in send_http
response = urllib2.urlopen(req, data).read()
File "/usr/lib/python2.6/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.6/urllib2.py", line 397, in open
response = meth(req, response)
File "/usr/lib/python2.6/urllib2.py", line 510, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.6/urllib2.py", line 429, in error
result = self._call_chain(*args)
File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain
result = func(*args)
File "/usr/lib/python2.6/urllib2.py", line 605, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "/usr/lib/python2.6/urllib2.py", line 391, in open
response = self._open(req, data)
File "/usr/lib/python2.6/urllib2.py", line 409, in _open
'_open', req)
File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain
result = func(*args)
File "/usr/lib/python2.6/urllib2.py", line 1161, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib/python2.6/urllib2.py", line 1133, in do_open
h.request(req.get_method(), req.get_selector(), req.data, headers)
File "/usr/lib/python2.6/httplib.py", line 910, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.6/httplib.py", line 947, in _send_request
self.endheaders()
File "/usr/lib/python2.6/httplib.py", line 904, in endheaders
self._send_output()
File "/usr/lib/python2.6/httplib.py", line 776, in _send_output
self.send(msg)
File "/usr/lib/python2.6/httplib.py", line 735, in send
self.connect()
File "/usr/lib/python2.6/httplib.py", line 716, in connect
self.timeout)
File "/usr/lib/python2.6/socket.py", line 504, in create_connection
sock = socket(af, socktype, proto)
File "/usr/lib/python2.6/socket.py", line 182, in __init__
_sock = _realsocket(family, type, proto)
RuntimeError: maximum recursion depth exceeded while calling a Python object

This repeats every few seconds, ad infinitum.