Terminate HTTP request in EntityToJsonApi before returning results

Created on 5 January 2023, over 2 years ago
Updated 31 August 2023, over 1 year ago

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

🐛 Bug report
Status

Fixed

Version

3.23

Component

Code

Created by

🇫🇮Finland j-vee Turku, Finland

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024