fix: S3Uploader multipart uploadPart() loads 10MB chunks into memory #183

Open
opened 2026-06-29 14:40:06 +00:00 by jmiller · 1 comment
Owner

Summary

S3Uploader.php:245-280uploadPart() reads entire 10 MB chunks into a $data string and passes to CURLOPT_POSTFIELDS. For a 1 GB file that's 100 iterations holding 10 MB strings. The single-upload path correctly uses CURLOPT_PUT + CURLOPT_INFILE streaming, but multipart does not.

Location

src/Engine/S3Uploader.php:245-280

Fix

Use CURLOPT_PUT + CURLOPT_INFILE with fseek() to the chunk offset and CURLOPT_INFILESIZE for each part, matching the streaming pattern in singleUpload().

## Summary `S3Uploader.php:245-280` — `uploadPart()` reads entire 10 MB chunks into a `$data` string and passes to `CURLOPT_POSTFIELDS`. For a 1 GB file that's 100 iterations holding 10 MB strings. The single-upload path correctly uses `CURLOPT_PUT` + `CURLOPT_INFILE` streaming, but multipart does not. ## Location `src/Engine/S3Uploader.php:245-280` ## Fix Use `CURLOPT_PUT` + `CURLOPT_INFILE` with `fseek()` to the chunk offset and `CURLOPT_INFILESIZE` for each part, matching the streaming pattern in `singleUpload()`.
jmiller added the component: remote label 2026-06-29 14:40:06 +00:00
Author
Owner

Branch created: feature/183-fix-s3uploader-multipart-uploadpart-load

git fetch origin
git checkout feature/183-fix-s3uploader-multipart-uploadpart-load
Branch created: [`feature/183-fix-s3uploader-multipart-uploadpart-load`](https://git.mokoconsulting.tech/MokoConsulting/MokoSuiteBackup/src/branch/feature/183-fix-s3uploader-multipart-uploadpart-load) ```bash git fetch origin git checkout feature/183-fix-s3uploader-multipart-uploadpart-load ```
Sign in to join this conversation.