[New-bugs-announce] [issue3006] subprocess.Popen causes socket to remain open after close
report at bugs.python.org
Thu May 29 23:02:39 CEST 2008
New submission from Matt Mulsow <matt.mulsow at gmail.com>:
On Windows, when a suprocess.Popen command is issued while
a socket connection is being handled the socket connection
will not close until the output of the subprocess is consumed.
The connection remains open even though the request.close()
command returns successfully and the program starts listening
for the next connection.
On Windows, the request.close() call translates to the C function
closesocket. The closesocket function by default attempts to do
a graceful close in the background. By changing the linger structure,
the closesocket function can be made to do a hard close. That fixes
my problem, but then queued data may not be flushed before the
socket closes. I cannot figure out why the closesocket's graceful
shutdown is waiting for the Popen command to complete.
This problem does not show up with the equivalent os.popen command.
use telnet to connect on port 6288
watch for connection to close or not
components: Library (Lib)
title: subprocess.Popen causes socket to remain open after close
type: resource usage
versions: Python 2.5
Added file: http://bugs.python.org/file10471/socketTest.py
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce