From: "Yu, Mingli" <mingli.yu@windriver.com>
To: Scott Murray <scott.murray@konsulko.com>
Cc: bitbake-devel@lists.openembedded.org, Martin.Jansa@gmail.com
Subject: Re: [PATCH] prserv: make localhost work
Date: Wed, 1 Sep 2021 09:20:29 +0800 [thread overview]
Message-ID: <d3e95bfb-593d-0fd8-bcb8-65af9537f5ea@windriver.com> (raw)
In-Reply-To: <f3b29ae8-7582-4b3b-abaf-8e1eb08bf54@spiteful.org>
On 8/31/21 11:01 PM, Scott Murray wrote:
> [Please note: This e-mail is from an EXTERNAL e-mail address]
>
> On Tue, 31 Aug 2021, mingli.yu@windriver.com wrote:
>
>> From: Mingli Yu <mingli.yu@windriver.com>
>>
>> After [1] introduced, the PR server doesn't work in docker when use
>> below setting like before.
>> PRSERV_HOST = "localhost:0"
>>
>> And it's because the localhost is resolved to an ipv6 address ::1 as
>> the below bitbake-prserv shows.
>> bitbake$ bitbake-prserv --start --host=localhost --port=42005
>> bitbake$ cat prserv.log
>> Traceback (most recent call last):
>> File "/OE/nodistro/honister/bitbake/bin/bitbake-prserv", line 55, in <module>
>> ret = main()
>> File "/OE/nodistro/honister/bitbake/bin/bitbake-prserv", line 46, in main
>> ret=prserv.serv.start_daemon(options.dbfile, options.host, options.port,os.path.abspath(options.logfile), options.read_only)
>> File "/OE/nodistro/honister/bitbake/lib/prserv/serv.py", line 226, in start_daemon
>> run_as_daemon(daemon_main, pidfile, os.path.abspath(logfile))
>> File "/OE/nodistro/honister/bitbake/lib/prserv/serv.py", line 202, in run_as_daemon
>> func()
>> File "/OE/nodistro/honister/bitbake/lib/prserv/serv.py", line 224, in daemon_main
>> server.serve_forever()
>> File "/OE/nodistro/honister/bitbake/lib/bb/asyncrpc/serv.py", line 233, in serve_forever
>> self.start()
>> File "/OE/nodistro/honister/bitbake/lib/bb/asyncrpc/serv.py", line 144, in start_tcp
>> self.server = self.loop.run_until_complete(server_coro)
>> File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
>> return future.result()
>> File "/usr/lib/python3.8/asyncio/streams.py", line 94, in start_server
>> return await loop.create_server(factory, host, port, **kwds)
>> File "/usr/lib/python3.8/asyncio/base_events.py", line 1463, in create_server
>> raise OSError(err.errno, 'error while attempting '
>> OSError: [Errno 99] error while attempting to bind on address ('::1', 42005, 0, 0): cannot assign requested address
>>
>> So add the extra logic to make the localhost resolved as expected to
>> make the PR service work especially in docker.
>>
>> [1] 6a2b23e2 prserv: Replace XML RPC with modern asyncrpc implementation
>>
>> Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
>> ---
>> lib/prserv/serv.py | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/prserv/serv.py b/lib/prserv/serv.py
>> index 68db3d3e..0a20b927 100644
>> --- a/lib/prserv/serv.py
>> +++ b/lib/prserv/serv.py
>> @@ -126,7 +126,7 @@ class PRServSingleton(object):
>>
>> def start(self):
>> self.prserv = PRServer(self.dbfile)
>> - self.prserv.start_tcp_server(self.host, self.port)
>> + self.prserv.start_tcp_server(socket.gethostbyname(self.host), self.port)
>> self.process = self.prserv.serve_as_process()
>>
>> if not self.prserv.address:
>> @@ -221,7 +221,7 @@ def start_daemon(dbfile, host, port, logfile, read_only=False):
>> dbfile = os.path.abspath(dbfile)
>> def daemon_main():
>> server = PRServer(dbfile, read_only=read_only)
>> - server.start_tcp_server(host, port)
>> + server.start_tcp_server(ip, port)
>> server.serve_forever()
>>
>> run_as_daemon(daemon_main, pidfile, os.path.abspath(logfile))
>>
>
> Richard has picked up Martin's patch in master-next, I think that would
> remove the need for this one?
The patch from Martin is just make the error message specific, but
localhost still does't work in docker with Martin's patch and this patch
is used to make it work in docker.
Thanks,
>
> Scott
>
next prev parent reply other threads:[~2021-09-01 1:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <16A04D855643B3E7.30479@lists.openembedded.org>
2021-08-31 7:48 ` [PATCH] prserv: make localhost work Yu, Mingli
2021-08-31 15:01 ` Scott Murray
2021-09-01 1:20 ` Yu, Mingli [this message]
2021-09-01 1:31 ` [bitbake-devel] " Joshua Watt
2021-09-01 1:51 ` Yu, Mingli
2021-09-01 9:14 ` Martin Jansa
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=d3e95bfb-593d-0fd8-bcb8-65af9537f5ea@windriver.com \
--to=mingli.yu@windriver.com \
--cc=Martin.Jansa@gmail.com \
--cc=bitbake-devel@lists.openembedded.org \
--cc=scott.murray@konsulko.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.