got-scraping icon indicating copy to clipboard operation
got-scraping copied to clipboard

fix(resolve-protocol): isolate ALPN resolve queue per proxy

Open jakvbs opened this issue 2 weeks ago • 0 comments

Problem

When sessionData is not provided, createResolveProtocol() falls back to global defaults (protocolCache + resolveAlpnQueue). The ALPN resolve queue is keyed only by target host/port (no proxy URL), so a hung proxy CONNECT/ALPN resolve can poison subsequent requests that rotate to a different proxy (they end up awaiting the same pending resolve).

Fix

  • Scope the default ALPN caches/queue by proxyUrl when sessionData is nullish.
  • Keep memory bounded via an LRU (maxSize: 100).

Tests

  • Add a regression test that starts a local HTTPS server + a hanging CONNECT proxy + a working CONNECT proxy.
  • The second request (via the working proxy) must succeed even while the first request is still stuck on ALPN resolution via the hanging proxy.

CI ergonomics

  • Make npm test non-interactive (vitest run).
  • Skip Apify-proxy integration tests when APIFY_PROXY_PASSWORD is not set (keeps fork PR CI green, while still running in the main repo where the secret is available).

jakvbs avatar Jan 14 '26 20:01 jakvbs