Random "read ECONNRESET" crashes or 500s under load.
The remote end closed the TCP connection mid-flight (idle timeout, restart, LB drain).
req.on('error', e => { if (e.code === 'ECONNRESET') return retry(); throw e })new https.Agent({ keepAlive: true, keepAliveMsecs: 30000 })retryOn(error => error.code === "ECONNRESET")Treat any upstream as a service that restarts: timeouts + retries + circuit breaker.
NinjaOps publishes free engineering guides. Some outbound links are affiliate links: they cost you nothing and support the site.
Last reviewed 2026-10-02 · NinjaOps SEO grid · DevOps blog