Recently I found myself stumped by a very unhelpful error message, while trying to mount a CherryPy app behind Apache using the built-in adapter for
_cpmodpy. I was seeing a text/plain 500 response containing only:
Unrecoverable error in the server.
This message comes from
cherrypy._cperror.bare_error, which is called by
_cpmodpy if an exception is raised outside of the ordinary CherryPy request handling code. In my case, some erroneous initialisation code was raising an exception when the CherryPy tree was being set up, causing the handler to drop out to the
Unfortunately a traceback isn't included in the error message, even if
request.show_tracebacks is True, since the CherryPy Request object is not in scope (and may never have existed) at that point; I guess in this case the best thing to do is be conservative and not show the traceback. A traceback is apparently logged to somewhere though — but (maybe due to a misconfiguration?) it wasn't showing up in my Apache logs.
In the end I hacked
_cpmodpy.py to show me a traceback, revealing the error in my initialisation code. Here is the trivial patch:
--- _cpmodpy.py +++ _cpmodpy.py @@ -202,7 +202,7 @@ except: tb = format_exc() cherrypy.log(tb) - s, h, b = bare_error() + s, h, b = bare_error(tb) send_response(req, s, h, b) return apache.OK