Memory limit hit when deleting MANY aliases

Created on 18 April 2019, over 5 years ago
Updated 15 August 2024, 3 months ago

Problem/Motivation

I have a system with a custom entity that gets imported from a remote system.
The aliases are generated based on the locally imported entities.

From time to time it's needed to make a refresh on the whole set of data, meaning delete all + update all.
When the command is executed against a set of ~90k such entities, the process fails with the out of memory PHP error during the delete phase (with drush pathauto:aliases-delete canonical_entities:TYPE --purge).

The issue is that once the error is experienced, the DB transaction is rolled back and the data is not deleted. So it is essentially preventing the completion of the whole operation.

Proposed resolution

  1. Somehow disable the static cache or whatever it is responsible for the excessive memory allocations.
  2. Consider having a limit option exposed on the command. Like delete (but only up-to 5k, 10k items).
  3. Consider time limit option. Run for 10 seconds and then stop.

In comparison, the bulk generation is using constant memory for it's work and it is not experiencing the same memory issues.
All the 90K aliases were generated with running a single command.

Remaining tasks

Discussion, patch, etc.

User interface changes

New option on the drush interface (maybe).

API changes

None expected.

Data model changes

None expected.

Release notes snippet

None expected.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇧🇬Bulgaria ndobromirov

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

Merge Requests

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