1. Create a pattern [term:vocabulary:name]/[term:parents:join-path]/[term:name] for multiple vocabularies and multiple languages.
2. Click "Bulk generate" to creat new taxonomy aliases.
3. Bulk generation never stops unless apache server is stopped. In some time dblog generates 20000 messages:

Warning: max(): Array must contain at least one element in Drupal\pathauto\Plugin\pathauto\AliasType\EntityAliasTypeBase->batchUpdate() (line 172 of .../modules/pathauto/src/Plugin/pathauto/AliasType/EntityAliasTypeBase.php) #0 .../core/includes/ ...

4. Taxonomy terms are generated fine, so second time create/update/regenerate work ok.
5. If I delete alias, and start generating again, generation hangs again.

Members fund testing for the Drupal project. Drupal Association Learn more


mindaugasd created an issue. See original summary.

LpSolit’s picture

Does this problem occur with taxonomy terms only or also for nodes and users? Which option did you select for the bulk update?

mindaugasd’s picture

Only taxonomy was selected.

pifagor’s picture

Status: Active » Needs review
771 bytes


Berdir’s picture

I get how this fixes the warning, but not sure about how this causes the loop? Can you reproduce this in a failing test?

mindaugasd’s picture

Not sure what "in a failing test" means.
Codebase is not on my computer, so cannot test it in the timely manner. But I can test it on occasion in some weeks to check if this patch makes the batch stop.

mindaugasd’s picture

Tested patch. It fixed 3 point - errors no longer appear, but all other points holds true - batch doesn't stop.
If no one had this problem until now, it could be website related.

Berdir’s picture

It looks like there is some sort of inconsistency in your data, that the count returns something different than the actual query.

One way to address that is to add a check on having less than 25 $ids returned from the query. If that's the case then we are finished.

If you know how, you could try to debug the code there a bit, you can use something like debug($context['sandbox']['total']) and debug($ids). This might affect other parts of your site as well.

Berdir’s picture

Status: Needs review » Postponed (maintainer needs more info)
Alex Zhulin’s picture

When bulk generating aliases for taxonomy terms from a vocabulary with hierarchy and all the root terms of the vocabulary are in the first batch, we get the aliases generated for all the terms in the vocabulary and next batch query returns no IDs.
It happens because \Drupal\pathauto\PathautoGenerator::updateEntityAlias() updates aliases for all child terms of each processed term.