summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatol Belski <anatol.belski@microsoft.com>2020-09-17 14:24:48 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-09-18 06:50:28 +0100
commit0e20f91c11afdc17ea776aa02e0cc8b0d59a23d4 (patch)
tree22c100b7658c3a0bbe950e4557d1f55b74725869
parent29081375659e3dcf1c578cd98ab2c8a2e9f07ca8 (diff)
downloadbitbake-0e20f91c11afdc17ea776aa02e0cc8b0d59a23d4.tar.gz
bitbake: hashserv: Fix localhost sometimes resolved to a wrong IP
From: Anatol Belski <anbelski@linux.microsoft.com> Using localhost for direct builds on host is fine. A case with a misbehavior has been sighted on a Docker build. Even when the host supports IPv6, but Docker is not configured correspondingly - some versions of the asyncio Python module seem to misbehave and try to use IPv6 where it's not supported in the container. This happens at least on some Ubuntu 18.04 based containers, resolving the IP explicitly appears to be the fix. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/hashserv/tests.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/hashserv/tests.py b/lib/hashserv/tests.py
index b34c43687..4566f2473 100644
--- a/lib/hashserv/tests.py
+++ b/lib/hashserv/tests.py
@@ -14,6 +14,7 @@ import sys
import tempfile
import threading
import unittest
+import socket
class TestHashEquivalenceServer(object):
@@ -163,4 +164,8 @@ class TestHashEquivalenceUnixServer(TestHashEquivalenceServer, unittest.TestCase
class TestHashEquivalenceTCPServer(TestHashEquivalenceServer, unittest.TestCase):
def get_server_addr(self):
- return "localhost:0"
+ # Some hosts cause asyncio module to misbehave, when IPv6 is not enabled.
+ # If IPv6 is enabled, it should be safe to use localhost directly, in general
+ # case it is more reliable to resolve the IP address explicitly.
+ return socket.gethostbyname("localhost") + ":0"
+