PHP Fatal error: Allowed memory exhausted when using migrate:status

Created on 1 November 2024, 4 months ago

Problem/Motivation

When using migrate:status without any migration IDs, we're encountering PHP Fatal error: Allowed memory exhausted errors.

PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 45056 bytes) in /var/www/docroot/core/lib/Drupal/Core/Database/StatementWrapperIterator.php on line 113

Prerequisites
Drupal core version 10.3.2
Migrate Tools version 6.0.4
PHP memory_limit 256M

Steps to reproduce

  1. drush si demo_umami -y
  2. drush en migrate_drupal migrate_tools -y
  3. drush migrate:status

Observe error

Proposed resolution

Pending πŸ’¬ Why does MigrateToolsCommands::migrationsList() utilize MigrationPluginManager to instantiate all plugins ? Active , replace

MigrateToolsCommands::migrationsList() usage of MigrationPluginManager here

    if (empty($migration_ids)) {
      // Get all migrations.
      $plugins = $manager->createInstances([]);
      $matched_migrations = $plugins;
    }

with something like the following, but using dependency injection

$migrations = \Drupal::EntityTypeManager()->getStorage('migration')->loadMultiple();
$migration_ids = implode(',', array_keys($migrations));

Remaining tasks

  • Consensus on problem
  • Consensus on solution
  • Patch
  • Tests?

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Active

Version

6.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jasonawant New Orleans, USA

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

Comments & Activities

Production build 0.71.5 2024