Skip to content

Fix: minor issue of tqdm lock leak during termination with TP - #88

Open
xinze-zheng wants to merge 2 commits into
FlashML-org:mainfrom
xinze-zheng:main
Open

Fix: minor issue of tqdm lock leak during termination with TP#88
xinze-zheng wants to merge 2 commits into
FlashML-org:mainfrom
xinze-zheng:main

Conversation

@xinze-zheng

Copy link
Copy Markdown

Use a process-local threading.RLock for scheduler-worker tqdm progress bars.

tqdm defaults to a multiprocessing lock, creating one POSIX semaphore per TP rank. FreeToken terminates workers before those locks are finalized, causing resource_tracker warnings. Only rank 0 renders progress, so cross-process locking is unnecessary. A thread lock provides the required in-process synchronization without allocating semaphores. thus removes the warning.
Example TP=4 warning:

/usr/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 4 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '

Tested on Qwen2.5 and TinyLlama with TP=2 and 4.

ezutfen added a commit to Zutfen-LLC/FreeToken that referenced this pull request Sep 4, 2026
…alid-attempt defect)

phaseC-1 on inferswarm04 chained arm_full_capture inside the per-case
loop: o_proj wrappers re-bound each case, duplicating capture records
per case (40 -> 604 records by case 48) until / filled (89 GB of
duplicated bundles) and torch.save failed. Duplicate host-side copies
only — each wrapper layer passes the exact tensor through, no device
math change; Phase B logits-derived margins/selected-eight unaffected
(decision-.f32 rows come from the pre-wrapper logits return value and
their sha256s are recorded per decision).

Fix: arm ONCE at startup (the accepted FlashML-org#76 pattern); per-case
isolation via sink swap only. Attempt phaseC-1 retained and classified
producer-capture-defect + infrastructure disk exhaustion (invalid).
ezutfen added a commit to Zutfen-LLC/FreeToken that referenced this pull request Sep 4, 2026
…seD-stress-1 defect)

The FlashML-org#88 chain runner only forwarded capture_step at the frozen envelope
positions 0/1/3/7, so the last-stage service retained decision rows
(and returned rule proofs) for only those four decisions. v3 needs the
ACTUAL full-vocab winner at ALL 8 decisions.

Fix: capture_step is sent on every decision (the last-stage keys its
retained decision-<i>.f32 rows off this value); the 15-envelope capture
positions themselves remain the frozen 0/1/3/7 (envelope reduction
unchanged; stages 1-2 emit their per-position sinks exactly as before —
positions 2/5/6 now also emit, which the reducer's per-(position,
checkpoint) grouping already handles by ignoring non-frozen positions...

no: the reducer iterates CAPTURE_POSITIONS only, so extra positions are
inert). Attempt phaseD-stress-1 retained as invalid (incomplete decision
evidence: 4/8 rows per case).
ezutfen added a commit to Zutfen-LLC/FreeToken that referenced this pull request Sep 4, 2026
Accept the issue FlashML-org#88 physical producer and retain the terminal V3_HOLDOUT_FAIL campaign result as immutable evidence.
gdevenyi added a commit to gdevenyi/FreeToken that referenced this pull request Sep 5, 2026
…during termination with TP

Upstream FlashML-org#88 at 0d13314, merged onto deploy/chatdnp for the PR sweep.
Conflict in server/launch.py: kept the GPU assignment block and call the tqdm lock setup after it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0173pf9k9fSVtwbm3f898HDt
@gdevenyi

gdevenyi commented Sep 5, 2026

Copy link
Copy Markdown

Tried on 2 x RTX 6000 Ada (sm_89) serving Qwen3.8-Flash-Next (RadixArk NVFP4) at TP=2, offload backend, fp8 KV pool of 8 x 262,144 tokens, merged onto my deploy branch (main af71ba4 + #385/#386/#389/#392/#354 and ten other open PRs), tests run on the box, then put in production.

Merged; the only conflict is the GPU-assignment block that landed in launch.py at the same place. Not verified beyond a clean shutdown of the TP=2 server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants