[Zope-dev] Understanding LeakFinder-0.1.1

Rodrigo Dias Arruda Senra rodsenra at gpr.com.br
Wed Jan 12 14:15:52 EST 2005


Hi,

reading LeakFinder's code (version 0.1.1) I was puzzled by:

"""
if not hasattr(DB, '_lf_real_open'):
     # Patch DB with a way to block open operations.
     DB._open_lock = allocate_lock()
     def open(self, *args, **kw):
         self._open_lock.acquire()
         self._open_lock.release()
         return apply(self._lf_real_open, args, kw)
     DB._lf_real_open = DB.open
     DB.open = open

"""

Inside the  redefined::open(), the lock is acquired and
released before delegating to the original::open().
I wonder if:

1) That was done intentionally as a _step_on_the_break_ measure
2) acquire() or release() cause a desired side effect (despite 1),
    inside ZODB's inner-sanctum (that eludes me)
3) That was not the original intention, where apply() should come
    between acquire() and release()
4) none above (I'd appreciate to learn why)

I've sent this mail to zope-dev because it was the only
address mentioned in the source code.

best regards,
Rod Senra

-- 
Rodrigo Senra
MSc Computer Engineer     rodsenra at gpr.com.br
GPr Sistemas Ltda       http://www.gpr.com.br



More information about the Zope-Dev mailing list