Problem/Motivation
- https://www.drupal.org/project/jsonapi_boost uses EntityToJsonApi-service to warm up JSON:API caches in a queue
- If there are a lot of items queued, the server will quite fast hit PHP Fatal error: Allowed memory size of ... bytes exhausted error
- This happens because the HTTP made in EntityToJsonApi->serialize is never terminated before the results are returned.
Steps to reproduce
- Our server env had a memory_limit of 400M
- Create hundreds of nodes and taxonomies, add them to the JSON:API warmer settings in jsonapi_boost
- Run drush warmer:enqueue jsonapi --run-queue and the process should die because of the memory running out
Proposed resolution
- Terminate the HTTP request before returning the results with the code from attached MR and the function will keep on running
Issue fork jsonapi_extras-3331257
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #5
bbralaNice find, thanks.