Open NiroDeveloper opened 4 months ago
Thank you for reporting this issue!
As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.
If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.
Thank you!
I have the same issue, large file downloads aren't always correctly downloaded.
Any workarounds?
@francoism90 @NiroDeveloper Are you running octane in HTTP/2 mode? https://github.com/laravel/octane/issues/873 and the PR https://github.com/laravel/octane/pull/875 could be related if so.
@Shkeats I'm running Octane on a nginx proxy.
Octane Version
2.6.2
Laravel Version
11.16.0
PHP Version
8.3.6
What server type are you using?
Swoole
Server Version
5.1.2
Database Driver & Version
No response
Description
Before i start, this is not a duplicate to https://github.com/laravel/octane/issues/903, this is about Swoole. Also large stream responses are fixed with https://github.com/laravel/octane/issues/636, but not this case.
While using Storage::download or Storage::response, laravel is creating a stream response that uses php fpassthru($stream). Somehow the buffering between fpassthru and ob_start does not work, instead it tries to load the full file into the memory. This leads to out of memory errors while downloading very big files.
If i replace the fpassthru with a fread-while-loop it is working as expected.
I can basically make a pull request, but need help with the solution... Is this more a problem in the laravel framework or PHP itself?
Steps To Reproduce