JsonSubItem Parser Memory Exhaustion

Created on 16 June 2025, 29 days ago

Problem/Motivation

The JsonSubItem parser suffers from memory exhaustion when processing large JSON responses with nested subitems. The current implementation loads all items and their subitems into memory at once, which can lead to PHP memory limits being exceeded. It fails whilst calling the parent JSON parser, see below error:

Error:

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 4096 bytes) in /web/modules/contrib/migrate_plus/src/Plugin/migrate_plus/data_parser/Json.php on line 59

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 40960 bytes) in /vendor/composer/ClassLoader.php on line 576

Steps to reproduce

source:
  plugin: url
  data_fetcher_plugin: http
  data_parser_plugin: json_subitem
  item_selector: Items
  subitem_selector: SubItems
  1. Set up a migration using the JsonSubItem parser with a large JSON response containing nested items
  2. Configure the migration with above YAML definition
  3. Run the migration with a large dataset (e.g., 200+ items with nested subitems)
  4. Observe PHP memory exhaustion error

Proposed resolution

TBD

Remaining tasks

TBD

User interface changes

N/A

API changes

N/A

Data model changes

N/A

🐛 Bug report
Status

Active

Version

6.0

Component

Plugins

Created by

🇧🇪Belgium baikho Antwerp, BE

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

Comments & Activities

Production build 0.71.5 2024