Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix S3 multipart uploads failing on large files #110

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

webaware
Copy link

Amazon S3 backups fail in BackWPup v3.6.10 - v3.8.0 when the backup file is very large (e.g. gigabytes). Previously logged on wp.org support forum.

A sample error looks like this:

PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 5242912 bytes)
in wp-content/plugins/backwpup/inc/class-destination-s3.php on line 773

This PR fixes the problem by replacing the multipart code with the recommended AWS SDK code using the MultipartUploader class to manage the upload.

@cuongdcdev
Copy link
Contributor

@webaware Thank you for the PR. I really appreciate it ❤️
About the issue, I think this will be fixed by override class-destination-s3.php in backwpup/inc/ with the one here: https://gist.github.com/cuongdcdev/6a751d4312f8e6ac056294ee638cb71b
Could you please help me test the path?
Thank you so much! 🙏

@webaware
Copy link
Author

webaware commented Jan 8, 2021

G'day Cuong, yes the forced garbage collection does resolve the problem -- memory stays at a stable level during the upload. Memory usage is a little more than using AWS' MultipartUploader, and also is doing more work by extracting temporary files to upload, so AWS' MultipartUploader is still the preferable method.

@cuongdcdev
Copy link
Contributor

Good day @webaware thank you for your help, I forwarded the PR to our dev :D

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.

None yet

2 participants