Summary
windows (3.12, demos) failed on PR #1532 CI with:
tests/examples/test_echo_thin_waist.py::test_echo_example_starts_and_prints_thin_waist
Job: https://github.com/libp2p/py-libp2p/actions/runs/34793308970/job/103821521009
SHA: f95e378d (ICE-Lite follow-up; does not touch this test or echo demo)
Same PR: tox (3.10–3.13, demos) and windows (3.11/3.13, demos) passed. Only windows 3.12 demos failed (1 failed / 191 passed).
What the logs show (not a Thin-Waist assert)
There is no Did not capture peer ID / multiaddr / waiting assertion failure. The reported failure is:
ExceptionGroup: multiple unraisable exception warnings (3 sub-exceptions)
...
File ".../_pytest/unraisableexception.py", line 128, in unraisable_hook
tracemalloc_tb = "\n" + tracemalloc_message(unraisable.object)
File ".../_pytest/tracemalloc.py", line 13, in tracemalloc_message
tb = tracemalloc.get_object_traceback(source)
AttributeError: partially initialized module 'tracemalloc' has no attribute
'get_object_traceback' (most likely due to a circular import)
RuntimeError: Failed to process unraisable exception
Preceding context also shows:
ResourceWarning: unclosed <socket.socket ... laddr=('127.0.0.1', 65353),
raddr=('127.0.0.1', 65348)>
So the child echo process / pipes left unclosed sockets; pytest then failed while processing those unraisable/ResourceWarnings (tracemalloc hook blow-up), not because Thin Waist lines were missing.
Likely aggravated by #1533 enabling filterwarnings = ["error::ResourceWarning"] in pyproject.toml.
Is the test well written / event-driven?
Partially event-driven, cleanup is not.
tests/examples/test_echo_thin_waist.py:
| Aspect |
Assessment |
| Ready signal |
Event-driven on stdout: reads lines until "Waiting for incoming connections..." (also captures I am … / echo-demo -d …). Good. |
| Empty-read loop |
Polls with time.sleep(0.05) + wall-clock timeout_s = 8.0 when readline() returns empty — acceptable for subprocess stdout, not Trio. |
| Docstring |
Claims “using Trio primitives” but the test is sync subprocess.Popen + time — misleading. |
| Unused fixtures |
monkeypatch, tmp_path unused. |
| Teardown |
terminate() then immediate kill() with no wait() / no closing stdout — classic source of unclosed sockets / pipes → ResourceWarning on Windows. |
| Isolation |
Spawns a real module process; fine for a smoke test, but teardown must be clean under the new ResourceWarning-as-error CI guard. |
Verdict: The readiness check is reasonably event-driven. The failure mode is teardown / resource-leak fragility under Windows + pytest unraisable + error::ResourceWarning, not a regression of Thin Waist printing. Unrelated to WebRTC ICE-Lite (#1532 / #1512).
Suggested fix
- In
test_echo_thin_waist: after seeing the waiting line, close stdout, proc.wait(timeout=…), only then kill if needed; use try/finally that always reaps the child.
- Optionally mark/filter this subprocess smoke path, or migrate to an in-process Trio listener fixture (true event-driven, no subprocess sockets).
- Re-run
windows (3.12, demos); treat intermittent unraisable/tracemalloc as a flake until teardown is fixed.
Refs
Summary
windows (3.12, demos)failed on PR #1532 CI with:tests/examples/test_echo_thin_waist.py::test_echo_example_starts_and_prints_thin_waistJob: https://github.com/libp2p/py-libp2p/actions/runs/34793308970/job/103821521009
SHA:
f95e378d(ICE-Lite follow-up; does not touch this test or echo demo)Same PR:
tox (3.10–3.13, demos)andwindows (3.11/3.13, demos)passed. Only windows 3.12 demos failed (1 failed / 191 passed).What the logs show (not a Thin-Waist assert)
There is no
Did not capture peer ID / multiaddr / waitingassertion failure. The reported failure is:Preceding context also shows:
So the child echo process / pipes left unclosed sockets; pytest then failed while processing those unraisable/
ResourceWarnings (tracemalloc hook blow-up), not because Thin Waist lines were missing.Likely aggravated by #1533 enabling
filterwarnings = ["error::ResourceWarning"]inpyproject.toml.Is the test well written / event-driven?
Partially event-driven, cleanup is not.
tests/examples/test_echo_thin_waist.py:"Waiting for incoming connections..."(also capturesI am …/echo-demo -d …). Good.time.sleep(0.05)+ wall-clocktimeout_s = 8.0whenreadline()returns empty — acceptable for subprocess stdout, not Trio.subprocess.Popen+time— misleading.monkeypatch,tmp_pathunused.terminate()then immediatekill()with nowait()/ no closingstdout— classic source of unclosed sockets / pipes →ResourceWarningon Windows.Verdict: The readiness check is reasonably event-driven. The failure mode is teardown / resource-leak fragility under Windows + pytest unraisable +
error::ResourceWarning, not a regression of Thin Waist printing. Unrelated to WebRTC ICE-Lite (#1532 / #1512).Suggested fix
test_echo_thin_waist: after seeing the waiting line, closestdout,proc.wait(timeout=…), only thenkillif needed; usetry/finallythat always reaps the child.windows (3.12, demos); treat intermittent unraisable/tracemalloc as a flake until teardown is fixed.Refs