From 4010e6a25d80d07c0098e19ad094d355d40a613a Mon Sep 17 00:00:00 2001 From: Gavin Li Date: Mon, 11 Nov 2019 14:17:39 -0800 Subject: 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 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 Signed-off-by: Richard Purdie Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- bitbake/lib/prserv/serv.py | 1 + 1 file changed, 1 insertion(+) (limited to 'bitbake') 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): 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)) -- cgit v1.2.3-54-g00ecf