Memory limit hit when deleting MANY aliases

Created on 18 April 2019, about 5 years ago
Updated 20 May 2024, about 1 month 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

Needs review

Version

1.0

Component

Code

Created by

πŸ‡§πŸ‡¬Bulgaria ndobromirov

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.69.0 2024