Problem/Motivation

When upgrading to Drupal 9, it is possible that the configured action for the 'update_non_existent' setting no longer exists. In this case, we want the import to fail gracefully, not with a fatal error.

Right now, the import would fail with an error like this:

The website encountered an unexpected error. Please try again later.
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "foo" plugin does not exist. Valid plugin IDs for Drupal\Core\Action\ActionManager are: commerce_publish_product, commerce_unpublish_product, entity_delete_action:commerce_product, entity_delete_action:commerce_store, feeds_feed_delete_action, node_unpromote_action, node_unpublish_action, node_publish_action, node_unpublish_by_keyword_action, node_assign_owner_action, node_promote_action, node_save_action, node_make_sticky_action, node_make_unsticky_action, node_delete_action, user_cancel_user_action, user_unblock_user_action, user_block_user_action, user_remove_role_action, user_add_role_action, action_send_email_action, entity:save_action:commerce_product_variation, entity:save_action:commerce_product, entity:save_action:commerce_product_attribute_value, entity:save_action:feeds_feed, entity:save_action:file, entity:save_action:group, entity:save_action:group_content, entity:save_action:node, entity:save_action:user, entity:unpublish_action:commerce_product_variation, entity:unpublish_action:commerce_product, entity:unpublish_action:node, entity:unpublish_action:path_alias, entity:publish_action:commerce_product_variation, entity:publish_action:commerce_product, entity:publish_action:node, entity:publish_action:path_alias, action_goto_action, action_message_action, entity:delete_action:commerce_product, entity:delete_action:commerce_store, entity:delete_action:node in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

Proposed resolution

Catch and log exceptions during the Clean stage.

Remaining tasks

User interface changes

None.

API changes

None.

Data model changes

None.

Patch will follow.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

MegaChriz created an issue. See original summary.

MegaChriz’s picture

This patch catches a PluginNotFoundException in EntityProcessorBase::clean(). However, since the entity shouldn't be marked as cleaned, the exception is rethrown there as well. Therefore, the exception needs to be catched on layer above, which happens to be LazySubscriber.

Additionally, an exception is catched as well in EntityProcessorBase::calculateDependencies(). This is necessary for the test to change the setting 'update_non_existent' to a non-existing action plugin called 'foo'. It is necessary for fixing one D9 test failure as well, see #3129114-12: Fix Drupal 9 test failures.

andypost’s picture

Looks in related something was not polished enough (maybe upgrade path or missing reaction on removal of action)

  • MegaChriz committed 5538393 on 8.x-3.x
    Issue #3138185 by MegaChriz: Fixed Clean stage fails with fatal error...
MegaChriz’s picture

Status: Needs review » Fixed

I checked again if an error message gets logged when trying to save a feed type and that was the case:

The selected option for the setting "Previously imported items" in the feed type myfeed no longer exists. Please edit the feed type and select a different option for that setting.

So I think it's good enough. Committed #2.

@andypost
You are correct, that other issue is directly related.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.