All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yu, Mingli" <mingli.yu@windriver.com>
To: Joshua Watt <jpewhacker@gmail.com>
Cc: Scott Murray <scott.murray@konsulko.com>,
	bitbake-devel <bitbake-devel@lists.openembedded.org>,
	Martin Jansa <Martin.Jansa@gmail.com>
Subject: Re: [bitbake-devel] [PATCH] prserv: make localhost work
Date: Wed, 1 Sep 2021 09:51:32 +0800	[thread overview]
Message-ID: <af883af8-192c-0550-76ea-ee5190ba54c1@windriver.com> (raw)
In-Reply-To: <CAJdd5GaViYYCa6XovSO7n6ceSjBemn28bhN7TjSaCQgXkYpmuw@mail.gmail.com>



On 9/1/21 9:31 AM, Joshua Watt wrote:
> [Please note: This e-mail is from an EXTERNAL e-mail address]
> 
> On Tue, Aug 31, 2021 at 8:14 PM Yu, Mingli <mingli.yu@windriver.com> wrote:
>>
>>
>>
>> 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.
> 
> I think that was because IPv6 support had been incorrectly configured
> for Docker, perhaps that is the same thing happening in your setup?

In the same docker, the PR service works with PRSERV_HOST = 
"localhost:0" before, but it begins not work recently after some code 
restructure for prserv part.

BTW, the ipv6 is disabled in the docker of my env.

Thanks,

> 
>>
>> Thanks,
>>
>>>
>>> Scott
>>>
>>
>> 
>>

  reply	other threads:[~2021-09-01  1:45 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
2021-09-01  1:31       ` [bitbake-devel] " Joshua Watt
2021-09-01  1:51         ` Yu, Mingli [this message]
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=af883af8-192c-0550-76ea-ee5190ba54c1@windriver.com \
    --to=mingli.yu@windriver.com \
    --cc=Martin.Jansa@gmail.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=jpewhacker@gmail.com \
    --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.