New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB Connections are never released if an EndRequestEvent subscriber raises an exception #16

displacedaussie opened this Issue Feb 9, 2015 · 1 comment


None yet
2 participants

displacedaussie commented Feb 9, 2015

We have a Plone platform with a number of ZODB mounts and recently started noticing some significant memory issues with our instances. Each of our instances currently has one zserver-thread, but for some reason multiple DB connections were being created, resulting in memory use going up and up.

Eventually we tracked it down to a bug in collective.linkcheck, which is raising an Exception during an EndRequestEvent subscriber. Although we've stopped using the product for now, Zope should possibly handle this situation better.

The problem is reproducible with a basic event subscriber:

def test_end_request(event):
    raise Exception

A BaseRequest "holds" a number of objects, including the DB Connection. When a BaseRequest is closed, the EndRequestEvent is notified and the Request is then cleared, releasing the Connection (allowing it to be closed/released back to the pool) and any other objects that have been held.

If an Exception is raised in an EndRequestEvent subscriber, the Request is never cleared. The DB Connection and other objects are held forever.

The Request should release these objects even if an Exception has been raised.


This comment has been minimized.


do3cc commented Feb 10, 2015

Good find!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment