RohithPariki

#55618: fix: reject net.fetch when upload body stream errors

Merged
Created: Nov 5, 2026, 8:39:17 AM
Merged: Nov 9, 2026, 4:30:22 PM
6 comments
Target: main

Description of Change

Fixes #55372.

In lib/browser/api/net-fetch.ts, req.body.pipeTo(...) was invoked without a .catch() rejection handler. When a ReadableStream upload body errors or is cancelled mid-stream:

  1. An unhandled promise rejection (ERR_UNHANDLED_REJECTION) was emitted.
  2. The outer net.fetch promise never resolved or rejected, leaving the caller hanging indefinitely.
  3. The underlying ClientRequest was never aborted.

This change attaches a .catch() handler to pipeTo(...) that marks locallyAborted = true, calls r.abort(), and rejects the fetch promise with the stream error.

Added regression tests in spec/api-net.spec.ts verifying that net.fetch aborts and rejects when upload body streams encounter an error or are cancelled mid-stream.

Checklist

Release Notes

Notes: Fixed unhandled rejection and hang in net.fetch on upload stream error.

Backports

44-x-y
Merged
PR Number
#55690
Merged At
Nov 9, 2026, 7:57:30 PM
Released In
Not yet
Release Date
Not yet
45-x-y
Merged
PR Number
#55691
Merged At
Nov 9, 2026, 6:53:46 PM
Released In
Not yet
Release Date
Not yet
46-x-y
Merged
PR Number
#55692
Merged At
Nov 9, 2026, 6:53:17 PM
Released In
Not yet
Release Date
Not yet

Semver Impact

Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.

Semantic Versioning helps users understand the impact of updates:

  • Major (X.y.z): Breaking changes that may require code modifications
  • Minor (x.Y.z): New features that maintain backward compatibility
  • Patch (x.y.Z): Bug fixes that don't change the API
  • None: Changes that don't affect using facing parts of Electron