summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorGavin Li <gavin@matician.com>2019-11-11 14:17:39 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-25 21:26:15 +0000
commit4010e6a25d80d07c0098e19ad094d355d40a613a (patch)
treead028c130091236e30201c07259ddafddb1d5b2c /bitbake
parent0f408d8a2ea1eeb4adb721c256671714c1615d55 (diff)
downloadpoky-4010e6a25d80d07c0098e19ad094d355d40a613a.tar.gz
bitbake: prserv: fix ResourceWarning due to unclosed socket
With PRSERV_HOST = "localhost:0", this message would occasionally pop up during the initial cache read: WARNING: /home/matic/ambayocto/poky/bitbake/lib/bb/cache.py:446: ResourceWarning: unclosed <socket.socket fd=10, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 45655)> value = pickled.load() The file location stated is irrelevant; it just happens to be wherever CPython decides to run the garbage collector. The issue is that after we fork off a PRServer, self.socket is also duplicated. The parent side of it also needs to be closed. (Bitbake rev: cd970c9efa805ec3e7ba952df1701b347441ec7b) Signed-off-by: Gavin Li <gavin@matician.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/prserv/serv.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/bitbake/lib/prserv/serv.py b/bitbake/lib/prserv/serv.py
index be3acec36a..1d9148b817 100644
--- a/bitbake/lib/prserv/serv.py
+++ b/bitbake/lib/prserv/serv.py
@@ -243,6 +243,7 @@ class PRServer(SimpleXMLRPCServer):
243 try: 243 try:
244 pid = os.fork() 244 pid = os.fork()
245 if pid > 0: 245 if pid > 0:
246 self.socket.close() # avoid ResourceWarning in parent
246 return pid 247 return pid
247 except OSError as e: 248 except OSError as e:
248 raise Exception("%s [%d]" % (e.strerror, e.errno)) 249 raise Exception("%s [%d]" % (e.strerror, e.errno))