Problem/Motivation

I get a fatal error when unchecking the "URL aliases" in the Trash module settings after I had it turned on for a bit.

The website encountered an unexpected error. Try again later.
Drupal\Core\Entity\EntityStorageException: The field deleted has already been deleted and it is in the process of being purged. in Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->onFieldStorageDefinitionDelete() (line 763 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php).
Drupal\Core\Entity\Sql\SqlContentEntityStorage->Drupal\Core\Entity\Sql\{closure}() (Line: 1592)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrapSchemaException() (Line: 1573)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->onFieldStorageDefinitionDelete() (Line: 133)
Drupal\Core\Field\FieldStorageDefinitionListener->onFieldStorageDefinitionDelete() (Line: 241)
Drupal\Core\Entity\EntityDefinitionUpdateManager->uninstallFieldStorageDefinition() (Line: 118)
Drupal\trash\TrashManager->disableEntityType() (Line: 62)
Drupal\trash\EventSubscriber\TrashConfigSubscriber->onSave() (Line: 246)
Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}() (Line: 206)
Symfony\Component\EventDispatcher\EventDispatcher->callListeners() (Line: 56)
Symfony\Component\EventDispatcher\EventDispatcher->dispatch() (Line: 232)
Drupal\Core\Config\Config->save() (Line: 205)
Drupal\trash\Form\TrashSettingsForm->submitForm()
call_user_func_array() (Line: 105)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() (Line: 43)
Drupal\Core\Form\FormSubmitter->doSubmitForm() (Line: 589)
Drupal\Core\Form\FormBuilder->processForm() (Line: 321)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 53)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 715)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Steps to reproduce

  1. Enable URL aliases Trash support
  2. Modify some content and Trash some things.
  3. Disable Trash support for URL aliases
  4. Get the fatal error

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

dave reid created an issue. See original summary.

amateescu’s picture

Status: Active » Postponed (maintainer needs more info)

Tried to reproduce this and couldn't get the error. I suppose this could happen if you had more than 50 path aliases in the trash at some point, disabled the entity type in the module settings, then enabled it again and disabled again, without running cron in between. Did it happen without having so many path aliases in the trash?

dave reid’s picture

It's possible I had toggled and re-toggled without running cron. Should the form prevent me from changing those settings until the cron cleanup has been completed? I didn't have more than 5 aliases in the trash.

amateescu’s picture

Should the form prevent me from changing those settings until the cron cleanup has been completed? I didn't have more than 5 aliases in the trash.

Unchecking an entity type uninstalls the deleted field, so the form could check if there's any deleted field in the purging process, and give a hint about it. Do you think we should? It's not really a common use-case IMO.

In any case, the field data for 5 aliases should've been purged immediately, so there was something else happening that made you bump into that error..

amateescu’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Let's reopen this when it can be reproduced.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.