Skip to main content

Timeout / abort cleanup

The threat

Leaked timers and unconsumed response bodies can cause resource leaks, especially in long-running server processes. If a timeout fires after a response has already been handled, it can abort unrelated requests or leave dangling references.

How parcely prevents it

parcely combines timeout and user signals via AbortSignal.any([userSignal, AbortSignal.timeout(ms)]). The request lifecycle uses a finally block to:

  1. Clear any pending timers.
  2. Ensure the response body is consumed or discarded (no dangling ReadableStream).
  3. Clean up progress-tracking wrappers.

Error codes

ScenarioError code
Timeout firesERR_TIMEOUT
User signal abortsERR_ABORTED
Stream error during upload/downloadERR_NETWORK

Security table reference

This corresponds to row 9 in the security defaults table:

#DefenseDefault
9Timeout + user signal combined via AbortSignal.any; timers cleared in finallyAlways on

Always on

This cleanup behaviour is always active. There is no way to disable it.