I ran into this when I left import pdb and a pdb.set_trace() in my production code. When the pdb.set_trace() line was executed, python was waiting for my input to tell it to continue or step into, etc… Because the python code was being called by a web server I wasn’t there to press c to continue. After so long (not sure how long) it finally raised the BdbQuit exception.
I didn’t have anything setup to catch that exception so it raised a 500 in my web server.
It took me a while to understand that my debug code running in an a daemon/background was causing the issue. I felt silly.