Closed ctheune closed 9 years ago
In order to avoid this, you need to configure your logging so that the raven logger messages aren't directed to raven handler. Unless someone with a good understanding of Zope steps and opens a PR this will likely remain as it is.
I'm pretty good with Zope. I also know the guy who contributed the plugin. Having to rely on configuration is a bit of a no go as I see people mis-configure this easily (I'm seeing the ops' people side of applications). I'm in contact with @pilz who's currently working on a solution for this. We'll get back to you with a pull request or so when we have something working.
I think the raven internals could be made to avoid recursion generally, though, by doing some stack introspection and bailing out if you're in the stack too often.
Sounds fair though I'd rather avoid semi magic auto reconfiguration. This usually leads to complex and hardly maintainable system. I really need to think about this. Not sure whether it wouldn't be better solved through the documentation.
By the way, looking forward to the next step :)
Right. Wasn't thinking about automatic reconfiguration. However, somewhere in the stack this passes through your more generic code, right? In that case you can make semi magic detection of states that are very likely to be infinite recursions. Not much overhead and should be reliable enough. I'll get back to you when we have somethign to show. :)
Answering the #564 I notice that the raven logging handler shouldn't recurse like this. See: https://github.com/getsentry/raven-python/blob/master/raven/handlers/logging.py#L53-L57
Forget the previous comment I think I get the issue
@ctheune Mind testing the current master ? It shouldn't recurse as it did and should still log as usual.
We are trying that out now, I'll report back here when we have a few days of experience.
The internal warning when the Zope handler isn't able to extract request information will cause an infinite recursion.
I've had this a couple of times where I had to get up at night that some simple errors cause raven to go into an infinite loop like this (live traceback snapshot):
This obviously errors out with a maximum recursion depth:
However, it takes ages (read: 3 minutes or so) for sentry to get there and it blocks our threads when users accidentally trigger this multiple times in a row ...
I think this specific plugin needs to filter for its self-generated log-messages. (Seen at line 100 in https://github.com/getsentry/raven-python/blob/master/raven/contrib/zope/__init__.py )