Repository navigation
test: keep ht-notify and torchelastic leftovers out of the shared /tmp (#19) - #23
Merged
Merged
Conversation
Every ChallengeStore opened by a test leaves an empty ht-notify-<hash> directory (the directory is shared per state_dir, so production keeps closing without rmdir to avoid racing a starting peer), and torchrun leaves torchelastic_* directories: ~30k inodes on the shared host filled /tmp. A session fixture points PET_LOG_DIR under basetemp and, at session end, rmdirs only the empty ht-notify-* directories of this uid that appeared during the session. Tests cover the cleanup, a live peer socket, a pre-existing directory and 8 threads x start/close on a shared state_dir. No src/ change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 11 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
'from conftest import' resolves to whichever conftest.py pytest registered first; in a shard collecting tests/trainer first it picked tests/trainer/conftest.py and failed at collection (same defect as the systemd probe classifier). Move remove_new_empty_notify_dirs to tests/notify_cleanup.py, used by tests/conftest.py and the unit test. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Issue #19: the test suite filled the shared
/tmptmpfs (1 048 576 inodes) on the CI/dev host: ~15.7k emptyht-notify-*directories (one perChallengeStore, created for the v2 IPC socket) and ~14.2ktorchelastic_*directories (torchrun logs), hitting 100 % inode use.What (tests only, no
src/change)tests/conftest.py: session autouse fixture_tmp_leak_guard. It setsPET_LOG_DIRunder pytest's basetemp (torchrun logs follow) and, at session end,rmdirs only the emptyht-notify-*directories of the same uid that appeared during the session (a non-empty one may be a live peer's, so it is left).tests/challenge/test_store_notify_dir.py: cleanup removes a directory left by a closed store; keeps a directory holding a live socket; keeps a directory that predates the snapshot; 8 threads x start/close on one sharedstate_dirnever fail.Why not fix it in
src/A first version removed the shared directory on
close_v2_notifications()with a retry in_start_notifications_v2. Independent review (Lens) reproduced the race it introduces: 30 failures / 3 200 starts with 8 threads. The directory is shared perstate_dir, so production keeps the empty directory; the leak is a test-suite concern and is fixed in the test session.Evidence
pytest tests/challenge/test_store_notify_dir.py tests/test_systemd_probe_classify.py: 12 passed.ls -d /tmp/ht-notify-* | wc -lidentical before and after the targeted run (978 / 978).Risk / rollback
Tests only. Revert the merge commit.
🤖 Generated with Claude Code