Subject Memory leak when using events
Author Dominik Psenner

Good morning,

 

as written yesterday we have recently implemented a way to react on database events in our python based program. But we are facing several outages with that implementation. First we encountered at least three errors when invoking event_conduit(events), namely:

·         Error reading data from the connection.

·         Error writing data to the connection.

·         unknown ISC error 0

 

Then I had the suspicion that the private memory was increasing and never dropping, thus I investigated a little further and used the dummy program from yesterday and let it run overnight. It produced and consumed about 1.250.000 events and the process memory raised from 27mb to roughly 400mb. Luckily I was wise enough to start the test script with pdb and this is the outcome:

 

A memory leak in the class EventBlock(object), defined in dbcore.py at line 1687 caused by the cyclic reference introduced in its constructor at lines 1705 and 1709:

 

1705:            self.__queue.put((ibase.OP_RECORD_AND_REREGISTER,self))

1709:     self.__queue = queue

 

The events issue is now officially promoted to be a blocker for us. Looking at what the code does, it looks mostly like a chicken and egg problem. Ideas / suggestions? Is this the right place to come up with such problems (i.e. do the maintainers of the fdb python package read this mailinglist)?

 

Best regards,

Dominik