diff --git a/p2p/constants.py b/p2p/constants.py index a408a9863b..31e4f513f2 100644 --- a/p2p/constants.py +++ b/p2p/constants.py @@ -122,7 +122,7 @@ MAX_SEQUENTIAL_PEER_CONNECT = 5 # Timeout used when fetching peer candidates from discovery -REQUEST_PEER_CANDIDATE_TIMEOUT = 0.5 +REQUEST_PEER_CANDIDATE_TIMEOUT = 1 # The maximum number of concurrent attempts to establis new peer connections MAX_CONCURRENT_CONNECTION_ATTEMPTS = 10 diff --git a/tests/integration/test_trinity_cli.py b/tests/integration/test_trinity_cli.py index c11444260a..739a44ffee 100644 --- a/tests/integration/test_trinity_cli.py +++ b/tests/integration/test_trinity_cli.py @@ -119,6 +119,9 @@ async def test_web3(command, async_process_runner): "Started DB server process", "Started networking process", "IPC started at", + # Ensure we do not start making requests that depend on the networking + # process, before it is connected to the JSON-RPC-API + "EventBus Endpoint networking connecting to other Endpoint bjson-rpc-api", }) attached_trinity = pexpect.spawn('trinity', ['attach'], logfile=sys.stdout, encoding="utf-8") diff --git a/trinity/tools/async_process_runner.py b/trinity/tools/async_process_runner.py index 97e4c47769..e95c9553f8 100644 --- a/trinity/tools/async_process_runner.py +++ b/trinity/tools/async_process_runner.py @@ -1,4 +1,5 @@ import asyncio +import logging import os import signal from typing import ( @@ -10,6 +11,7 @@ class AsyncProcessRunner(): + logger = logging.getLogger("trinity.tools.async_process_runner.AsyncProcessRunner") def __init__(self, debug_fn: Callable[[bytes], None] = None) -> None: self.debug_fn = debug_fn @@ -64,4 +66,7 @@ async def kill_after_timeout(self, timeout_sec: int) -> None: raise TimeoutError(f'Killed process after {timeout_sec} seconds') def kill(self) -> None: - os.killpg(os.getpgid(self.proc.pid), signal.SIGKILL) + try: + os.killpg(os.getpgid(self.proc.pid), signal.SIGKILL) + except ProcessLookupError: + self.logger.info("Process %s has already disappeared", self.proc.pid)