All of
 help / color / mirror / Atom feed
From: "Yu, Mingli" <>
To: <>, <>,
Subject: [PATCH] prserv: make localhost work
Date: Tue, 31 Aug 2021 15:48:07 +0800	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

From: Mingli Yu <>

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.port,os.path.abspath(options.logfile), options.read_only)
      File "/OE/nodistro/honister/bitbake/lib/prserv/", line 226, in start_daemon
        run_as_daemon(daemon_main, pidfile, os.path.abspath(logfile))
      File "/OE/nodistro/honister/bitbake/lib/prserv/", line 202, in run_as_daemon
      File "/OE/nodistro/honister/bitbake/lib/prserv/", line 224, in daemon_main
      File "/OE/nodistro/honister/bitbake/lib/bb/asyncrpc/", line 233, in serve_forever
      File "/OE/nodistro/honister/bitbake/lib/bb/asyncrpc/", line 144, in start_tcp
        self.server = self.loop.run_until_complete(server_coro)
      File "/usr/lib/python3.8/asyncio/", line 616, in run_until_complete
        return future.result()
      File "/usr/lib/python3.8/asyncio/", line 94, in start_server
        return await loop.create_server(factory, host, port, **kwds)
      File "/usr/lib/python3.8/asyncio/", 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 <>
 lib/prserv/ | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/prserv/ b/lib/prserv/
index 68db3d3e..0a20b927 100644
--- a/lib/prserv/
+++ b/lib/prserv/
@@ -126,7 +126,7 @@ class PRServSingleton(object):
     def start(self):
         self.prserv = PRServer(self.dbfile)
-        self.prserv.start_tcp_server(, self.port)
+        self.prserv.start_tcp_server(socket.gethostbyname(, 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)
     run_as_daemon(daemon_main, pidfile, os.path.abspath(logfile))

       reply	other threads:[~2021-08-31  7:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
2021-08-31  7:48 ` Yu, Mingli [this message]
2021-08-31 15:01   ` [PATCH] prserv: make localhost work 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
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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \

* 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.