• Kirill Smelkov's avatar
    bigfile/zodb: Do not hold reference to ZBigFileH indefinitely in Connection.onOpenCallback · 059c71e1
    Kirill Smelkov authored
    If we do - ZBigFileH objects just don't get garbage collected, and
    sooner or later this way it leaks enough filedescriptors so that main
    zope loop breaks:
        Traceback (most recent call last):
          File ".../bin/runzope", line 194, in <module>
          File ".../eggs/Zope2-2.13.22-py2.7.egg/Zope2/Startup/run.py", line 26, in run
          File ".../eggs/Zope2-2.13.22-py2.7.egg/Zope2/Startup/__init__.py", line 105, in run
          File ".../eggs/Zope2-2.13.22-py2.7.egg/Lifetime/__init__.py", line 43, in loop
          File ".../eggs/Zope2-2.13.22-py2.7.egg/Lifetime/__init__.py", line 53, in lifetime_loop
            asyncore.poll(timeout, map)
          File ".../parts/python2.7/lib/python2.7/asyncore.py", line 145, in poll
            r, w, e = select.select(r, w, e, timeout)
        ValueError: filedescriptor out of range in select()
        $ lsof -p <runzope-pid> |grep ramh | wc -l
    So continuing 64d1f40b (bigfile/zodb: Monkey-patch for ZODB.Connection
    to support callback on .open()) let's change the implementation to use
    WeakSet for callbacks list.
    Yes, because weakref to bound methods release immediately, we give up
    flexibility to subscribe to arbitrary callbacks. If it become an issue,
    something like WeakMethod from py3 or recipes from the net how to do it
    are there.
Last commit
Last update
tests Loading commit data...
__init__.py Loading commit data...
_bigfile.c Loading commit data...
file_file.py Loading commit data...
file_zodb.py Loading commit data...
pagefault.c Loading commit data...
pagemap.c Loading commit data...
ram.c Loading commit data...
ram_hugetlbfs.c Loading commit data...
ram_shmfs.c Loading commit data...
virtmem.c Loading commit data...