Environment details
- OS: Debian
- PHP version: 8.4
- Package name and version:
google/cloud-storage:v1.48.5
Steps to reproduce
- Have a file in PHP memory
- Use
uploadAsync on the bucket
- Check
/tmp directory (directory is OS/php.ini dependent)
- There is a temp file there for the upload that is never cleared
Code example
$promises = [];
for ($i = 0; $i < 100; $i++) {
$fileAsString = file_get_contents('some-path'); // doesn't matter how we acquire it, this is just a simple example.
$promises[] = $bucket->uploadAsync($fileAsString);
}
Utils::unwrap($promises);
Assuming a 1MB file, our /tmp directory now holds 100MB.
On stateless environments were storage size is limited (like GKE), this can quickly cause pod evictions for scripts that do a lot of uploads.
A workaround is to store the file somewhere, and then pass a resource to the upload, but in some scenarios this is inefficient or is expected to be taken care of by the library.
Any temp files created by this library should be cleared by this library.
Environment details
google/cloud-storage:v1.48.5Steps to reproduce
uploadAsyncon the bucket/tmpdirectory (directory is OS/php.ini dependent)Code example
Assuming a 1MB file, our
/tmpdirectory now holds 100MB.On stateless environments were storage size is limited (like GKE), this can quickly cause pod evictions for scripts that do a lot of uploads.
A workaround is to store the file somewhere, and then pass a
resourceto the upload, but in some scenarios this is inefficient or is expected to be taken care of by the library.Any temp files created by this library should be cleared by this library.