Jason,

I wrote a little test program and it looks like a file object is
cleaned up by the library when it is unbound so based on what I see
running this code there is no need to unlock or close as long as the
file object loses scope.

Test program produces no open files looking in /proc/pid_of_python/fd
by the time it waits on the prompt.

import portalocker

def do_file_opens():
  for i in range (0, 10000):
    f = open("/tmp/junk", "r")
    portalocker.lock(f, portalocker.LOCK_EX)

do_file_opens()
# Suspend on terminal prompt
input = raw_input('Waiting to end')

My apologies for the noise, I should have tested this by writing the
program first, no need for a patch.

I hope you find the cause looking in /proc as described.

Ron

Reply via email to