Search code examples
pythonpython-2.7webwebobstackunderflow

What could cause a Block stack underflow in python?


The Application Context

We are developing an experimental web Framework using "solely" WebOb. We are handling concurrent requests and it's basically a quite simple integration of WebOb. We are hosting our application on webfaction.com

The thing is we have this Fatal Python Error that appears in our log:

Fatal Python error: XXX block stack underflow

There is no other traceback or information. and it makes our application crashes (it restarts automatically minutes later). We never had that problem in developpment.

EDIT: I've checked and my python application memory is way too high, it could be a related problem

What I tried

The thing is, when I try to crossreference the Access log, there is nothing that corresponds to that access time.

As I said, there is no traceback or info on the error.

So, I first searched on what is a block stack underflow in Python and I found this very interesting article: http://tech.blog.aknin.name/2010/07/22/pythons-innards-interpreter-stacks/ which explains what is a block stack underflow.

EDIT:I also tried removing all the .pyc and restarting the server. No results

The Question

So, Here is my question: What could cause a block stack underflow in the compiler? What "type" of code could cause this?


Solution

  • First, try to remove all .pyc files (and .pyo if any), and restarting the server. If it doesn't help, please report the issue to http://bugs.python.org/ --- it really looks like a Python bug. The only way I can think of getting this would be by using obscure trickery like generating custom bytecode sequences.

    If you cannot post a way for us to reproduce the problem, you can also try to edit Objects/frameobject.c in the Python source code, in PyFrame_BlockPop(), to display more information before the crash. At least _PyObject_Dump(f); _PyObject_Dump(f->f_code); would be useful in locating where the error is.