mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 13:09:50 +00:00
bitbake: process: Don't leak open pipes upon reconnection
If we reconnect to the server, stop leaking pipes and clean up after ourselves. (Bitbake rev: f41e4e971e807157be68cf4496580494b8b60643) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -420,7 +420,11 @@ def connectProcessServer(sockname, featureset):
|
|||||||
finally:
|
finally:
|
||||||
os.chdir(cwd)
|
os.chdir(cwd)
|
||||||
|
|
||||||
|
readfd = writefd = readfd1 = writefd1 = readfd2 = writefd2 = None
|
||||||
|
eq = command_chan_recv = command_chan = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
# Send an fd for the remote to write events to
|
# Send an fd for the remote to write events to
|
||||||
readfd, writefd = os.pipe()
|
readfd, writefd = os.pipe()
|
||||||
eq = BBUIEventQueue(readfd)
|
eq = BBUIEventQueue(readfd)
|
||||||
@@ -435,9 +439,22 @@ def connectProcessServer(sockname, featureset):
|
|||||||
|
|
||||||
server_connection = BitBakeProcessServerConnection(command_chan, command_chan_recv, eq, sock)
|
server_connection = BitBakeProcessServerConnection(command_chan, command_chan_recv, eq, sock)
|
||||||
|
|
||||||
|
# Close the ends of the pipes we won't use
|
||||||
|
for i in [writefd, readfd1, writefd2]:
|
||||||
|
os.close(i)
|
||||||
|
|
||||||
server_connection.connection.updateFeatureSet(featureset)
|
server_connection.connection.updateFeatureSet(featureset)
|
||||||
|
|
||||||
except:
|
except (Exception, SystemExit) as e:
|
||||||
|
if command_chan_recv:
|
||||||
|
command_chan_recv.close()
|
||||||
|
if command_chan:
|
||||||
|
command_chan.close()
|
||||||
|
for i in [writefd, readfd1, writefd2]:
|
||||||
|
try:
|
||||||
|
os.close(i)
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
sock.close()
|
sock.close()
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user