Tribler/py-ipv8

The test suite locks up on (some) Mac(s)

qstokkink opened this issue · 1 comments

Our test suite locks up in socket.getaddrinfo() on Mac (in particular the GitHub Actions Macs). Annoyingly, the lockup handler in TestBase normally does not show the output and just prints a "Segfault?" message.

The test-suite locked up! Force quitting! Thread dump:
THREAD#4614796800
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/messaging/interfaces/udp/test_endpoint.py", line 50, in setUp
|       self.endpoint2_listener = DummyEndpointListener(self.endpoint2)
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/messaging/interfaces/udp/test_endpoint.py", line 23, in __init__
|       super().__init__(endpoint)
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/endpoint.py", line 152, in __init__
|       self.my_estimated_wan = self.my_estimated_lan
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/endpoint.py", line 168, in my_estimated_lan
|       self._my_estimated_lan = (self._get_lan_address(True)[0], self.endpoint.get_address()[1])
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/endpoint.py", line 252, in _get_lan_address
|       return self._guess_lan_address(get_lan_addresses()), (0 if bootstrap else self.endpoint.get_address()[1])
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/interfaces.py", line 56, in get_lan_addresses
|       for found in (provider.get_addresses_buffered() - BLACKLIST):
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/addressprovider.py", line 58, in get_addresses_buffered
|       self.discover_addresses()
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/addressprovider.py", line 42, in discover_addresses
|       self.addresses = self.get_addresses()
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/any_os/getaddrinfo.py", line 23, in get_addresses
|       interface_specifications.extend(socket.getaddrinfo(socket.gethostname(), None))
|   File "/Users/runner/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/socket.py", line 918, in getaddrinfo
|       for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
The test-suite locked up! Force quitting! Thread dump:
THREAD#4460615168
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/dht/test_discovery.py", line 29, in setUp
|       self.initialize(DHTDiscoveryCommunity, 2)
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/base.py", line 202, in initialize
|       self.nodes = [self.create_node(settings, create_dht, enable_statistics) for _ in range(node_count)]
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/base.py", line 202, in <listcomp>
|       self.nodes = [self.create_node(settings, create_dht, enable_statistics) for _ in range(node_count)]
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/dht/test_discovery.py", line 41, in create_node
|       return MockIPv8("curve25519", DHTDiscoveryCommunity)
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/ipv8.py", line 37, in __init__
|       self.endpoint = AutoMockEndpoint()
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 154, in __init__
|       super().__init__(self._generate_unique_address(), self._generate_unique_address())
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 193, in _generate_unique_address
|       while address in internet or self._is_lan(address):
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 187, in _is_lan
|       address_tester = AddressTester.get_singleton(self)
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 128, in get_singleton
|       return AddressTester(endpoint)
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 118, in __init__
|       self._get_lan_address(True)
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/endpoint.py", line 252, in _get_lan_address
|       return self._guess_lan_address(get_lan_addresses()), (0 if bootstrap else self.endpoint.get_address()[1])
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/interfaces.py", line 56, in get_lan_addresses
|       for found in (provider.get_addresses_buffered() - BLACKLIST):
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/addressprovider.py", line 58, in get_addresses_buffered
|       self.discover_addresses()
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/addressprovider.py", line 42, in discover_addresses
|       self.addresses = self.get_addresses()
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/any_os/getaddrinfo.py", line 23, in get_addresses
|       interface_specifications.extend(socket.getaddrinfo(socket.gethostname(), None))
|   File "/Users/runner/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/socket.py", line 918, in getaddrinfo
|       for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
The test-suite locked up! Force quitting! Thread dump:
THREAD#4473513472
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/bootstrapping/dispersy/test_bootstrapper.py", line 21, in setUp
|       self.bootstrap_node = AutoMockEndpoint()
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 154, in __init__
|       super().__init__(self._generate_unique_address(), self._generate_unique_address())
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 193, in _generate_unique_address
|       while address in internet or self._is_lan(address):
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 187, in _is_lan
|       address_tester = AddressTester.get_singleton(self)
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 128, in get_singleton
|       return AddressTester(endpoint)
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 118, in __init__
|       self._get_lan_address(True)
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/endpoint.py", line 252, in _get_lan_address
|       return self._guess_lan_address(get_lan_addresses()), (0 if bootstrap else self.endpoint.get_address()[1])
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/interfaces.py", line 56, in get_lan_addresses
|       for found in (provider.get_addresses_buffered() - BLACKLIST):
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/addressprovider.py", line 58, in get_addresses_buffered
|       self.discover_addresses()
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/addressprovider.py", line 42, in discover_addresses
|       self.addresses = self.get_addresses()
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/any_os/getaddrinfo.py", line 23, in get_addresses
|       interface_specifications.extend(socket.getaddrinfo(socket.gethostname(), None))
|   File "/Users/runner/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/socket.py", line 918, in getaddrinfo
|       for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
The test-suite locked up! Force quitting! Thread dump:
The test-suite locked up! Force quitting! Thread dump:
THREAD#4528948736
THREAD#4721051136
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/REST/test_overlays_endpoint.py", line 37, in setUp
|       await self.initialize([], 1, [])
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/REST/rest_base.py", line 267, in initialize
|       self.nodes = [await self.create_node(settings) for _ in range(node_count)]
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/REST/rest_base.py", line 267, in <listcomp>
|       self.nodes = [await self.create_node(settings) for _ in range(node_count)]
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/REST/rest_base.py", line 282, in create_node
|       ipv8 = MockRestIPv8("curve25519", self.overlay_classes, settings)
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/REST/rest_base.py", line 179, in __init__
|       self.endpoint = AutoMockEndpoint()
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 154, in __init__
|       super().__init__(self._generate_unique_address(), self._generate_unique_address())
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 193, in _generate_unique_address
|       while address in internet or self._is_lan(address):
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 187, in _is_lan
|       address_tester = AddressTester.get_singleton(self)
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 128, in get_singleton
|       return AddressTester(endpoint)
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 118, in __init__
|       self._get_lan_address(True)
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/endpoint.py", line 252, in _get_lan_address
|       return self._guess_lan_address(get_lan_addresses()), (0 if bootstrap else self.endpoint.get_address()[1])
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/interfaces.py", line 56, in get_lan_addresses
|       for found in (provider.get_addresses_buffered() - BLACKLIST):
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/addressprovider.py", line 58, in get_addresses_buffered
|       self.discover_addresses()
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/addressprovider.py", line 42, in discover_addresses
|       self.addresses = self.get_addresses()
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/any_os/getaddrinfo.py", line 23, in get_addresses
|       interface_specifications.extend(socket.getaddrinfo(socket.gethostname(), None))
|   File "/Users/runner/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/socket.py", line 918, in getaddrinfo
|       for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
The test-suite locked up! Force quitting! Thread dump:
THREAD#4610848256
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/messaging/anonymization/test_community.py", line 55, in setUp
|       self.initialize(TunnelCommunity, 2)
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/base.py", line 202, in initialize
|       self.nodes = [self.create_node(settings, create_dht, enable_statistics) for _ in range(node_count)]
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/base.py", line 202, in <listcomp>
|       self.nodes = [self.create_node(settings, create_dht, enable_statistics) for _ in range(node_count)]
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/messaging/anonymization/test_community.py", line 80, in create_node
|       ipv8 = MockIPv8("curve25519", TunnelCommunity, settings=tunnel_settings)
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/ipv8.py", line 37, in __init__
|       self.endpoint = AutoMockEndpoint()
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 154, in __init__
|       super().__init__(self._generate_unique_address(), self._generate_unique_address())
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 193, in _generate_unique_address
|       while address in internet or self._is_lan(address):
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 187, in _is_lan
|       address_tester = AddressTester.get_singleton(self)
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 128, in get_singleton
|       return AddressTester(endpoint)
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 118, in __init__
|       self._get_lan_address(True)
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/endpoint.py", line 252, in _get_lan_address
|       return self._guess_lan_address(get_lan_addresses()), (0 if bootstrap else self.endpoint.get_address()[1])
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/interfaces.py", line 56, in get_lan_addresses
|       for found in (provider.get_addresses_buffered() - BLACKLIST):
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/addressprovider.py", line 58, in get_addresses_buffered
|       self.discover_addresses()
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/addressprovider.py", line 42, in discover_addresses
|       self.addresses = self.get_addresses()
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/any_os/getaddrinfo.py", line 23, in get_addresses
|       interface_specifications.extend(socket.getaddrinfo(socket.gethostname(), None))
|   File "/Users/runner/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/socket.py", line 918, in getaddrinfo
|       for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
The test-suite locked up! Force quitting! Thread dump:
THREAD#4616754688
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/test_community.py", line 192, in test_cancel_bootstrap
|       settings = CommunitySettings(my_peer=Peer(b'LibNaCLPK:' + b'0' * 32), endpoint=AutoMockEndpoint(),
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 154, in __init__
|       super().__init__(self._generate_unique_address(), self._generate_unique_address())
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 193, in _generate_unique_address
|       while address in internet or self._is_lan(address):
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 187, in _is_lan
|       address_tester = AddressTester.get_singleton(self)
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 128, in get_singleton
|       return AddressTester(endpoint)
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/test/mocking/endpoint.py", line 118, in __init__
|       self._get_lan_address(True)
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/endpoint.py", line 252, in _get_lan_address
|       return self._guess_lan_address(get_lan_addresses()), (0 if bootstrap else self.endpoint.get_address()[1])
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/interfaces.py", line 56, in get_lan_addresses
|       for found in (provider.get_addresses_buffered() - BLACKLIST):
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/addressprovider.py", line 58, in get_addresses_buffered
|       self.discover_addresses()
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/addressprovider.py", line 42, in discover_addresses
|       self.addresses = self.get_addresses()
|   File "/Users/runner/work/py-ipv8/py-ipv8/ipv8/messaging/interfaces/lan_addresses/any_os/getaddrinfo.py", line 23, in get_addresses
|       interface_specifications.extend(socket.getaddrinfo(socket.gethostname(), None))
|   File "/Users/runner/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/socket.py", line 918, in getaddrinfo
|       for res in _socket.getaddrinfo(host, port, family, type, proto, flags):

Calling get_providers().clear() in TestBase.setUp() seems to resolve this issue (from ..messaging.interfaces.lan_addresses.interfaces import get_providers).