Skip to content

fix(lib-storage): reject done() with TimeoutError when CompleteMultipartUpload hangs - #8073

Open
Zelys-DFKH wants to merge 1 commit into
aws:mainfrom
Zelys-DFKH:fix/lib-storage-complete-multipart-timeout
Open

fix(lib-storage): reject done() with TimeoutError when CompleteMultipartUpload hangs#8073
Zelys-DFKH wants to merge 1 commit into
aws:mainfrom
Zelys-DFKH:fix/lib-storage-complete-multipart-timeout

Conversation

@Zelys-DFKH

Copy link
Copy Markdown
Contributor

Issue

#7729

Description

Upload.done() hangs forever when the TCP connection carrying the CompleteMultipartUpload response is silently dropped by a network intermediary (firewall, DLP appliance, transparent proxy) while S3 assembles a large object server-side. This is common on uploads over ~15 minutes: all parts upload successfully, the complete call goes out, but the HTTP response never arrives because the proxy killed the idle connection. With no timeout on that client.send() call, the promise stalls indefinitely.

This adds a completeMultipartUploadTimeout option (milliseconds) to Upload. When set, the CompleteMultipartUpload send races against a setTimeout; if the timer fires first, done() rejects with a TimeoutError. Without the option, behavior is identical to before: no timeout imposed.

The workaround from #7729 (configure keepAlive: true on the HTTP agent) still works. This option is complementary for callers who can't control the network layer or who want a hard deadline.

Credit: @paffoobar's root-cause analysis in #7729.

This change was generated with AI assistance and reviewed by me.

Testing

Added two unit tests to Upload.spec.ts (54/54 passing):

  • Timeout set + CompleteMultipartUpload hangs indefinitely: rejects with TimeoutError after the configured milliseconds
  • No timeout set: resolves normally regardless of how long CompleteMultipartUpload takes (backward-compatible path verified)

Checklist

  • It's not a feature.
  • I didn't write any E2E tests.
  • I didn't add any public functions.
  • No streams here.

…artUpload hangs

Add `completeMultipartUploadTimeout` option to Upload. When set, a
dropped TCP connection during the CompleteMultipartUpload call (common
when assembling large objects on S3's side takes > 15 min and a
transparent proxy kills the idle socket) now rejects the done() promise
with a TimeoutError instead of hanging forever. The option defaults to
undefined, preserving existing behavior for callers who don't set it.

Fixes aws#7729

This change was generated with AI assistance and reviewed by me.
@Zelys-DFKH
Zelys-DFKH requested a review from a team as a code owner June 4, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant