Troy Farrell wrote at 2004-2-16 09:53 -0600:
Since I've upgraded from 2.6.2 to 2.7.0, the following product code causes zope to hang: ... imgout, imgin = popen2('convert -quality %s -geometry %sx%s - -' % (quality, width, height)) print "Writing to stdin" imgin.write(origimg._IMdata()) print "Finished writing to stdin\n" imgin.close() newimg.write(imgout.read()) imgout.close()
When I run zope in debug mode, I see "Started popen2" and the "Writing to stdin", but the process never gets to "Finished writing to stdin." Furthermore, zope will no longer respond to requests until I restart it.
This may be quite normal: As you might know: pipes have limited buffer only. When the buffers are full, you get a deadlock (as "write" waits for the buffer (to "convert") to get drained and this will only happen when the second buffer (from "convert") gets drained but you read this second buffer only after you have written everything). This is a well known problem with "popen2". You will need non-delaying IO to work (reliably) around it. -- Dieter