fix(rpc): avoid hang when requests race a dying rpc-server

Requests now register before testing for shutdown,
so either the reader loop or the caller answers them.
Also failed start() winds down its threads, ignoring a broken pipe on stdin.
This commit is contained in:
holger krekel
2026-08-16 23:21:15 +02:00
parent 0119db85ad
commit 307ff9def1
2 changed files with 49 additions and 7 deletions

View File

@@ -746,6 +746,11 @@ def test_early_failure(tmp_path) -> None:
with pytest.raises(JsonRpcError, match="invalid_dir"):
rpc.start()
# Requests issued after the server exited must fail immediately
# instead of waiting forever for the finished reader loop.
with pytest.raises(JsonRpcError, match="RPC server closed"):
rpc.get_system_info()
def test_mdn_doesnt_break_autocrypt(acf) -> None:
alice, bob = acf.get_online_accounts(2)