I am glad my poor programming bring web2py to even higher standards. To tell, I found a small app called AMPY, it implements the amp protocal stack that twisted uses but has both blocking and asyncro communication, blocking is I think what we would need in this case and it seems, at least in my first tests, to work as expected. (:
Best Regards,
Jason

On 10/08/2010 05:09 PM, mdipierro wrote:
Your patch is still useful because by-the-book that is teh right thing
to do. It should fix the problem with PyPy.

On Oct 8, 12:12 am, ron_m<[email protected]>  wrote:
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