Problem/Motivation

We are encountering a problem downloading large private files from a Drupal site.

The file downloads but the content of the file is:

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 400592896 bytes) in /var/www/vendor/symfony/http-foundation/BinaryFileResponse.php on line 347

This started happening after we upgraded from 11.3 to 11.4

Steps to reproduce

* Create a large private file (ours was around 450Mb).
* Attempt to download the file using the system/files path.
* Check the contents of the downloaded file, it should contain the oom error.

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Comments

lambic created an issue. See original summary.

lambic’s picture

As a test I downgraded Drupal to 11.3.22 and the error went away, but then I made the file a bit bigger and the error came back.

cilefen’s picture

Issue tags: -file, -download, -private files

What is the setup of the site?

lambic’s picture

Installed with composer in a docker container.
Private files directory is a volume.
Private files are attached to paragraphs which are in turn attached to a group entity (from the groups module).
File access is controlled by group permissions.
Private file paths are the standard system/files/... paths.
The files themselves are large csv files.
memory_limit is set to 512mb

What else would you need to know?

lambic’s picture

Also I've narrowed the file size down, the error starts occuring for files larger than 400mb

longwave’s picture

Prior to the update were files of over 512Mb possible? I haven't traced the code but I assume serving private files involves loading them into available memory, and some memory is needed by Drupal to do this; it is possible that in 11.3 to 11.4 memory usage has increased slightly so it may be that files that were close to the limit before are now over it?