Repair Keep-Alive Socket Leaks

    by Mariusz Wrzeszczynski

    1

    Repair HTTP keep-alive lifecycle bugs that leak sockets, exhaust pools, or cause intermittent resets after idle periods and deploys.

    Secure checkout via Stripe

    0 installsSecurity scanned

    Works with the AI tools you already use

    CClaude CodeCCursorCCodex CLIGGitHub CopilotGGemini CLIVVS CodeWWindsurfMManus+14 more

    See it in action

    You say

    Our Node.js API gets ECONNRESET after idle periods. We use Axios with keep-alive. Find the leak, fix the cleanup logic, and add a test for stale socket recovery.

    Your agent does

    I have modified src/clients/http.ts to align idle timeouts with your 60s load balancer limit and added a finally block for stream cleanup. Local tests confirm 100% socket reuse and successful recovery after synthetic connection resets. No infrastructure changes were made.

    What you get

    Eliminate file descriptor leaks in async worker processes.Align client keep-alive settings with load balancer idle timeouts.Prevent pool exhaustion by enforcing response body consumption.Implement safe retry logic for idempotent requests on stale connections.

    About this skill

    The problem

    Your application suffers from intermittent ECONNRESET errors, socket hang-ups, or rising file descriptor counts that eventually exhaust your connection pool. These issues often appear after idle periods or upstream deployments because the HTTP client lifecycle doesn't align with the infrastructure's timeout boundaries.

    What it does

    • Identifies leaked HTTP clients and unconsumed response bodies that cause pool exhaustion.
    • Synchronizes client-side idle timeouts with upstream load balancer and proxy boundaries.
    • Implements cancellation-safe cleanup to prevent stranded sockets after aborted requests.
    • Establishes deterministic regression tests for connection reuse and recovery.
    • Standardizes client ownership to prevent per-request agent construction.

    Frameworks & tools

    Works with any repository using standard HTTP clients like Axios, node-fetch, httpx, requests, or aiohttp. Utilizes Bash for local verification and repository-specific testing frameworks.

    Why this beats prompting it yourself

    Generic AI advice often suggests simply increasing pool sizes, which only masks leaks. This skill enforces a strict connection contract, tracing ownership from construction to shutdown and proving the fix with local synthetic fixtures that simulate upstream failures.

    Use cases

    • Fixing first-request failures that occur after service idle periods.
    • Stopping memory and file descriptor growth in long-running worker processes.
    • Ensuring streaming responses release sockets even when a consumer aborts early.
    • Hardening clients against ECONNRESET during upstream rolling deployments.

    Known limitations

    Cannot modify production infrastructure like load balancers or DNS settings. Does not support automatic retries for non-idempotent requests unless a safety contract is already present in the code.

    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

    Trust & safety

    Security scanned

    Verified clean today

    Listedtoday

    Creator

    Mariusz Wrzeszczynski
    Mariusz Wrzeszczynski

    298 skills on Agensi

    Frequently Asked Questions

    Popular in AI Agents & LLM Ops