Works with the AI tools you already use

    CClaude CodeCCursorCCodex CLIGGitHub CopilotGGemini CLI+17 more

    Repair Thread Pool Starvation

    by Mariusz Wrzeszczynski

    1

    Repair thread-pool starvation from nested waits, callback affinity, fan-out, or shutdown competition without adding capacity.

    Secure checkout via Stripe

    0 installsSecurity scanned

    See it in action

    You say

    Our Java report service uses a fixed pool of 8 workers. Each request task running in that pool submits a database mapping child back to the same pool and calls Future.get(). With 8 concurrent reports, all parents wait and all children remain queued forever. Repair locally with latches and fake database results. Keep 8 workers, the bounded queue, rejection policy, timeouts, retries, ordering, and result format; do not access the database or production executor.

    Your agent does

    Starvation cycle found. Eight parent tasks occupy all eight workers and synchronously wait for child tasks queued to the same executor, so no child can start. The repair uses repository-supported completion composition and explicit task ownership, preserves pool size, queue, rejection, timeout, retry, and result semantics, and proves progress with an eight-parent barrier fixture.

    What you get

    Eliminate deadlocks caused by nested task submissions in bounded pools.Resolve application hangs during shutdown due to task drain competition.Implement nonblocking task composition to ensure worker availability.Create deterministic tests to reproduce starvation under exact capacity.

    About this skill

    The problem

    Thread pool starvation occurs when tasks occupy every worker while synchronously waiting for child tasks queued to that same exhausted pool. This creates a capacity dependency cycle where the CPU sits idle while the application freezes under load.

    What it does

    • Identifies blocking and completion edges across request, child, and shutdown task paths.
    • Reconstructs the smallest saturation state to isolate capacity dependency cycles.
    • Removes same-pool blocking by implementing nonblocking composition or executor separation.
    • Preserves existing backpressure, rejection, and timeout semantics without increasing worker counts.
    • Builds deterministic saturation tests using exact-capacity barriers instead of sleeps.

    Frameworks & tools

    Works with Java/JVM (java.util.concurrent), C# (.NET Task Parallel Library), Python (concurrent.futures), and Go. Compatible with any environment using fixed or bounded executors.

    Why this beats prompting it yourself

    Most LLMs suggest increasing thread counts or timeouts, which only delays the crash. This skill enforces an acyclic task-capacity contract, identifying the structural dependency flaw that causes the freeze rather than just treating the symptoms.

    Use cases

    • Fixing deadlocks where parent tasks wait for child tasks in the same saturated pool.
    • Resolving shutdown sequences that hang behind tasks they are trying to drain.
    • Remediating throughput collapse in systems using nested submissions.
    • Verifying concurrency fixes with high-fidelity saturation tests.

    Known limitations

    Cannot move blocking work onto event loops or modify production worker counts. Requires repository access to inspect executor configurations and task submission paths.

    How to install

    Drop the file into your AI Agent. Works with Claude, Cursor, ChatGPT, and 20+ more.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Frequently Asked Questions

    Popular in AI Agents & LLM Ops