From: <Mikko.Rapeli@bmw.de>
To: <gavinli@thegavinli.com>
Cc: gavin@matician.com, bitbake-devel@lists.openembedded.org
Subject: Re: [PATCH] bitbake: prserv: fix ResourceWarning due to unclosed socket
Date: Tue, 12 Nov 2019 07:28:41 +0000 [thread overview]
Message-ID: <20191112072840.GI2398@hiutale> (raw)
In-Reply-To: <20191111221739.1663625-1-gavinli@thegavinli.com>
Hi,
On Mon, Nov 11, 2019 at 02:17:39PM -0800, gavinli@thegavinli.com wrote:
> From: Gavin Li <gavin@matician.com>
>
> With PRSERV_HOST = "localhost:0", this message would occasionally pop up
> during the initial cache read:
Thanks for this fix!
It's not occasionally, it's all the time with zeus and Debian build container...
If it helps:
Tested-by: Mikko Rapeli <mikko.rapeli@bmw.de>
-Mikko
> 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@matician.com>
> ---
> bitbake/lib/prserv/serv.py | 1 +
> 1 file changed, 1 insertion(+)
>
> 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))
> --
> 2.23.0
>
> --
> _______________________________________________
> bitbake-devel mailing list
> bitbake-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/bitbake-devel
next prev parent reply other threads:[~2019-11-12 7:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-11 22:17 [PATCH] bitbake: prserv: fix ResourceWarning due to unclosed socket gavinli
2019-11-12 7:28 ` Mikko.Rapeli [this message]
2019-11-12 22:19 ` Peter Kjellerstedt
-- strict thread matches above, loose matches on Subject: below --
2019-11-11 22:15 gavinli
2019-11-20 16:11 ` Martin Jansa
2019-11-23 14:01 ` Richard Purdie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191112072840.GI2398@hiutale \
--to=mikko.rapeli@bmw.de \
--cc=bitbake-devel@lists.openembedded.org \
--cc=gavin@matician.com \
--cc=gavinli@thegavinli.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.