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

Command icon 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

j-vee created an issue. See original summary.

bbrala made their first commit to this issue’s fork.

  • bbrala committed 2eafdffb on 8.x-3.x authored by j-vee
    Issue #3331257: Terminate HTTP request in EntityToJsonApi before...
bbrala’s picture

Status: Needs review » Fixed

Nice find, thanks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.