Skip to content

Adopt NeMo PR #13 gpu_worker lifecycle fixes + batches_inflight for parakeet #8686

Closed

Description

@beastoin

Summary

Adopt features from NeMo fork PR #13 into the omi parakeet server. PR #13 was well-tested with benchmark evidence (WER 1.84%, 174x RTFx sustained, zero failures at c=64).

We already adopted bug #1 (batch=1 collapse) as PR #8666, but with a simpler approach. PR #13 has a better fix plus 8 additional gpu_worker lifecycle bugs.

What to adopt

batch_engine.py — Better batch=1 fix

  • _batches_inflight counter — replaces our PR Fix parakeet batch=1 throughput collapse from flush_pending early reset #8666 approach. NeMo keeps the early _flush_pending reset but adds _batches_inflight counter so the flush loop only fires when no GPU work is inflight. This is better because it allows full-batch dispatches to use the second inflight slot while blocking timer-triggered partial flushes.

gpu_worker.py — 8 lifecycle bugs

# Bug Fix
2 _drain_queues crashes on cancelled futures Use _safe_set_exception
3 stop()/submit() race — futures to dead queues Shared _submit_lock
4 Pool readiness race — request before workers started Start pool workers before _ready.set()
5 Pool shutdown skips queue drain — futures hang Drain all queues after worker join
6 Prefetch shutdown misses _prefetch_queue Drain + join prefetch thread
7 Prefetch in-flight item leak — invisible to drain owned_item tracking with finally
8 _gc_counter shared across pool threads Per-thread local counter
9 start() requires args — breaks pod migration Optional args with defaults

New: AudioDurationExceededError

  • Dedicated exception class for duration guard violations.

Applicability to omi parakeet

Our gpu_worker.py doesn't have pool or prefetch modes, so bugs #4-8 don't apply. Applicable:

Source

by AI for @beastoin

Activity

  1. beastoin commented on Jun 30, 2026

    @beastoin
    CollaboratorAuthor

    Implementation Complete — PR #8688 Ready

    PR #8688 implements both features from NeMo PR #13:

    1. _batches_inflight counter — flush timer only fires when counter is 0, preventing batch=1 spam while allowing full-batch dispatches to use the second inflight slot
    2. _submit_lock — prevents stop/submit race condition across all submit methods

    Verification:

    • 37 unit tests pass (12 new covering counter lifecycle, OOM reset, concurrent races)
    • CODEx reviewer: PR_APPROVED_LGTM
    • CODEx tester: TESTS_APPROVED
    • GPU live test on L4: 100 requests at concurrency 1–16, zero failures, batching confirmed (101 reqs → 63 batches)

    Urgency note: T+8h monitoring of PR #8666 showed a 504 incident during peak (35 min, ~1,460 504s) caused by the exact _flush_pending serialization that PR #8688 fixes. The GPU sat idle for 4-minute stretches while 900+ requests queued.

    by AI for @beastoin

  2. added 2 commits that reference this issue on Jun 30, 2026
    eedb78d
    bdddec3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions