Skip to content

fix: handle uploadfile multipart abort on failure#19

Open
Nana-EC wants to merge 4 commits into
mainfrom
12-uploadfile-multipart-abort-on-failure
Open

fix: handle uploadfile multipart abort on failure#19
Nana-EC wants to merge 4 commits into
mainfrom
12-uploadfile-multipart-abort-on-failure

Conversation

@Nana-EC
Copy link
Copy Markdown
Contributor

@Nana-EC Nana-EC commented Mar 14, 2026

Description:
uploadFile() had no error handling after createMultipartUpload(). Any exception thrown during part upload or completeMultipartUpload() left the upload ID stranded in S3, accruing storage charges until manually aborted.

  • Wrap the upload body in a try/catch that calls abortMultipartUpload() before re-throwing. Any exception from the abort itself is attached as a suppressed exception so the original cause is not lost.
  • Regression test: an iterator that throws on first next() call confirms that after uploadFile() propagates the exception, no upload ID remains in listMultipartUploads() for the affected key.

Related issue(s):

Fixes #12

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@Nana-EC Nana-EC added this to the 0.1 milestone Mar 14, 2026
@Nana-EC Nana-EC self-assigned this Mar 14, 2026
Nana-EC added 3 commits March 13, 2026 23:21
uploadFile() had no error handling after createMultipartUpload(). Any
exception thrown during part upload or completeMultipartUpload() left
the upload ID stranded in S3, accruing storage charges until manually
aborted.

Wrap the upload body in a try/catch that calls abortMultipartUpload()
before re-throwing. Any exception from the abort itself is attached as
a suppressed exception so the original cause is not lost.

Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>
)

Regression test: an iterator that throws on first next() call confirms
that after uploadFile() propagates the exception, no upload ID remains
in listMultipartUploads() for the affected key.

Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>
Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>
@Nana-EC Nana-EC force-pushed the 12-uploadfile-multipart-abort-on-failure branch from 577eeb5 to fb08c3a Compare March 14, 2026 03:21
Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>
@Nana-EC Nana-EC marked this pull request as ready for review March 17, 2026 16:31
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.

uploadFile leaks incomplete multipart uploads on failure

1 participant