raven-python icon indicating copy to clipboard operation
raven-python copied to clipboard

`IndexError: pop from empty list` on request finished signal handler

Open raphael-riel opened this issue 8 years ago • 1 comments

Raven-Python 6.0.0 on Django 1.9.13

All affected requests are HEAD. But not all HEAD requests are affected. Neither all of the exact same requests(Uptime tracking system) are affected.

IndexError: pop from empty list
  File "raven/middleware.py", line 20, in common_exception_handling
    yield
  File "raven/middleware.py", line 71, in close
    self._close()
  File "django/http/response.py", line 252, in close
    signals.request_finished.send(sender=self._handler_class)
  File "raven/contrib/django/middleware/__init__.py", line 111, in request_finished
    client.transaction.pop(self._txid)
  File "raven/utils/transaction.py", line 47, in pop
    return self.stack.pop()

Could this be caused by a request_finished sent without having the prerequisite request_started ? I suspect a premature close of the TCP/HTTP connection causing the request cycle behave in a weird manner.

On a 7days range, this error happens on few candidates (<10) over a very large sample (100,000+) of identical requests spread across tens of dockers hosts running the same codebase.

2017-05-05 at 7 29 am 2017-05-05 at 7 44 am

raphael-riel avatar May 05 '17 11:05 raphael-riel

We ran into this too. With raven 6.7.0 and Django 2.0.4

michael-k avatar Apr 25 '18 08:04 michael-k