zopefoundation / Products.LongRequestLogger

Dump stack traces of long running requests of a Zope2 instance to a log file
Other
3 stars 6 forks source link

dumper: do not crash on exceptions while rendering the request #2

Closed jmuchemb closed 7 years ago

jmuchemb commented 7 years ago

For example, instances of App.ZApplication.ZApplicationWrapper:

TypeError: unbound method __repr__() must be called with Application instance as first argument (got nothing instead)

(for instances of old-style classes, __getattr__ catches __repr__ if the latter is not defined)

The consequence is that the monitor thread crashed and next we had the following failures on each request:

ERROR ZServerPublisher exception caught
Traceback (most recent call last):
  File "ZServer/PubCore/ZServerPublisher.py", line 31, in __init__
    response=b)
  File "ZPublisher/Publish.py", line 455, in publish_module
    environ, debug, request, response)
  File "Products/LongRequestLogger/__init__.py", line 19, in publish_module_standard
    return publish_module_standard.original(*args, **kw)
  File "Products/LongRequestLogger/monitor.py", line 98, in __exit__
    os.write(self.event_pipe[1], '\0')
OSError: [Errno 32] Broken pipe
leorochael commented 7 years ago

@jmuchemb, thank you for the fix.

Do you mind adding an entry to docs/HISTORY.rst on the same commit?