What could cause a Block stack underflow in python?
Asked Answered
N

1

6

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?

Neoclassicism answered 7/12, 2012 at 2:28 Comment(0)
Z
8

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.

Zenobia answered 7/12, 2012 at 2:40 Comment(3)
Thanks for the info! I'll try to see if I can get more answers from the folk around here. If I can't, I'll mark your answers as accepted I have tried removing .pyc and restarting the server, I'll edit my questionEmeric
I resolved this issue by nuking my virtual environment and recreating. Don't know what caused it, but this appeared to fix it.Landed
I ran into this issue with Python 3.10.12 and used this answer https://mcmap.net/q/54147/-python3-project-remove-__pycache__-folders-and-pyc-files for cleaning up the files and __pycache__ directories, and that resolved the issue.Permeability

© 2022 - 2024 — McMap. All rights reserved.