getsentry / raven-python

Raven is the legacy Python client for Sentry (getsentry.com) — replaced by sentry-python
https://sentry.io
BSD 3-Clause "New" or "Revised" License
1.68k stars 657 forks source link

Error on command exit #736

Open ryanhiebert opened 8 years ago

ryanhiebert commented 8 years ago

I regularly get errors at the end of Django processes, about NoneType not being callable. It's only at termination of a program, and cleanup, so I never knew where to look. Today I finally saw this error in the Django development server, and it gave me more of a traceback, which seems to lead me here. Has anyone seen this before? Is it likely a misconfiguration of my app somehow?

[15/Feb/2016 19:43:38] "GET /favicon.ico HTTP/1.1" 301 0
Unhandled exception in thread started by <function wrapper at 0x10c869230>
Error in sys.excepthook:
Traceback (most recent call last):
  File "/Users/ryanhiebert/Envs/aspiredu/lib/python2.7/site-packages/raven/base.py", line 216, in handle_exception
    self.captureException(exc_info=exc_info)
  File "/Users/ryanhiebert/Envs/aspiredu/lib/python2.7/site-packages/raven/base.py", line 701, in captureException
    'raven.events.Exception', exc_info=exc_info, **kwargs)
  File "/Users/ryanhiebert/Envs/aspiredu/lib/python2.7/site-packages/raven/contrib/django/client.py", line 146, in capture
    request = getattr(SentryLogMiddleware.thread, 'request', None)
AttributeError: 'NoneType' object has no attribute 'thread'

Original exception was:
Traceback (most recent call last):
  File "/Users/ryanhiebert/Envs/aspiredu/lib/python2.7/site-packages/django/utils/autoreload.py", line 237, in wrapper
    filename = traceback.extract_tb(tb)[-1][0]
TypeError: 'NoneType' object is not callable
dcramer commented 8 years ago

Seemingly something is deleting SentryLogMiddleware. If you can find a good way to reproduce this (in isolation) we can investigate further. I'm not sure what would cause this in Python, but it's possible that the way sys.excepthook works we need to account for things like this.

ryanhiebert commented 8 years ago

Interesting, I will have to see if I can come up with more details based on that idea. Thus far I haven't been able to reproduce it reliably, even though it has been happening very often. Perhaps this seed can help me figure out something that I can nail use with git bisect to nail down the change that introduced it, and perhaps find the problem.

joej commented 7 years ago

I just got this today, also: [06/Nov/2016 18:42:09] "GET /static/assets/fonts/roboto-v15-latin-500.woff HTTP/1.1" 304 0 [06/Nov/2016 18:42:09] "GET /static/assets/json/sunbursts/SO-progs.json HTTP/1.1" 304 0 [06/Nov/2016 18:42:09] "GET /static/assets/fonts/noto-sans-v6-latin-700.woff HTTP/1.1" 304 0 [06/Nov/2016 18:42:09] "GET /static/assets/json/sunbursts/NDO-progs.json HTTP/1.1" 304 0 [06/Nov/2016 18:42:09] "GET /static/assets/json/sunbursts/RGM-progs.json HTTP/1.1" 304 0 [06/Nov/2016 18:42:09] "GET /static/assets/fonts/Material-Design-Iconic-Font.woff?v=1.0.1 HTTP/1.1" 304 0 ^C(toast) MM203287-PC (joe)$ Unhandled exception in thread started by <function wrapper at 0x10e8fb848> Traceback (most recent call last): File "/Users/judge/.pyenv/versions/toast/lib/python2.7/site-packages/django/utils/autoreload.py", line 234, in wrapper filename = traceback.extract_tb(tb)[-1][0] TypeError: 'NoneType' object is not callable