[oe-commits] [bitbake] 01/02: prserv: fix ResourceWarning due to unclosed socket
git at git.openembedded.org
git at git.openembedded.org
Wed Nov 13 22:49:45 UTC 2019
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master-next
in repository bitbake.
commit c45b0140c37f2d68c4fa08cd17f0321b8d6524a8
Author: Gavin Li <gavin at matician.com>
AuthorDate: Mon Nov 11 14:17:39 2019 -0800
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.
Signed-off-by: Gavin Li <gavin at matician.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
lib/prserv/serv.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/prserv/serv.py b/lib/prserv/serv.py
index 2bc6890..b854ba1 100644
--- a/lib/prserv/serv.py
+++ b/lib/prserv/serv.py
@@ -243,6 +243,7 @@ class PRServer(SimpleXMLRPCServer):
try:
pid = os.fork()
if pid > 0:
+ self.socket.close() # avoid ResourceWarning in parent
return pid
except OSError as e:
raise Exception("%s [%d]" % (e.strerror, e.errno))
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list