tripal/t4d8

Type Field Bug: Genome Assembly

laceysanderson opened this issue · 4 comments

I came across this while testing PR #303. We will fix this after that PR is merged and after resolving issue #310.

Steps to reproduce

  1. Create a Genome Assembly (only required values are needed). This step works fine.
  2. Edit the same genome assembly you just created. Do not make any changes and click save. You should see the following errors on your entity page and see the following error in the logs:

Screen Shot 2022-12-19 at 10 36 08 AM

PDOException: SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "analysisprop_c1" DETAIL: Key (analysis_id, type_id, rank)=(1, 31, 0) already exists. in /var/www/drupal9/web/core/lib/Drupal/Core/Database/StatementWrapper.php:145 Stack trace: #0 /var/www/drupal9/web/core/lib/Drupal/Core/Database/StatementWrapper.php(145): PDOStatement->execute(NULL) #1 /var/www/drupal9/web/core/modules/pgsql/src/Driver/Database/pgsql/Insert.php(98): Drupal\Core\Database\StatementWrapper->execute(NULL, Array) #2 /var/www/drupal9/web/modules/contrib/tripal/tripal_chado/src/Plugin/TripalStorage/ChadoStorage.php(146): Drupal\pgsql\Driver\Database\pgsql\Insert->execute() #3 /var/www/drupal9/web/modules/contrib/tripal/tripal_chado/src/Plugin/TripalStorage/ChadoStorage.php(364): Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage->insertChadoRecord(Array, 'analysisprop', 0, Array) #4 /var/www/drupal9/web/modules/contrib/tripal/tripal/src/Entity/TripalEntity.php(559): Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage->updateValues(Array) #5 /var/www/drupal9/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(562): Drupal\tripal\Entity\TripalEntity->preSave(Object(Drupal\Core\Entity\Sql\SqlContentEntityStorage)) #6 /var/www/drupal9/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(756): Drupal\Core\Entity\EntityStorageBase->doPreSave(Object(Drupal\tripal\Entity\TripalEntity)) #7 /var/www/drupal9/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(517): Drupal\Core\Entity\ContentEntityStorageBase->doPreSave(Object(Drupal\tripal\Entity\TripalEntity)) #8 /var/www/drupal9/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(804): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\tripal\Entity\TripalEntity)) #9 /var/www/drupal9/web/core/lib/Drupal/Core/Entity/EntityBase.php(339): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object(Drupal\tripal\Entity\TripalEntity)) #10 /var/www/drupal9/web/core/lib/Drupal/Core/Entity/EntityForm.php(285): Drupal\Core\Entity\EntityBase->save() #11 /var/www/drupal9/web/modules/contrib/tripal/tripal/src/Form/TripalEntityForm.php(42): Drupal\Core\Entity\EntityForm->save(Array, Object(Drupal\Core\Form\FormState)) #12 [internal function]: Drupal\tripal\Form\TripalEntityForm->save(Array, Object(Drupal\Core\Form\FormState)) #13 /var/www/drupal9/web/core/lib/Drupal/Core/Form/FormSubmitter.php(114): call_user_func_array(Array, Array) #14 /var/www/drupal9/web/core/lib/Drupal/Core/Form/FormSubmitter.php(52): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState)) #15 /var/www/drupal9/web/core/lib/Drupal/Core/Form/FormBuilder.php(592): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState)) #16 /var/www/drupal9/web/core/lib/Drupal/Core/Form/FormBuilder.php(320): Drupal\Core\Form\FormBuilder->processForm('tripal_entity_b...', Array, Object(Drupal\Core\Form\FormState)) #17 /var/www/drupal9/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\tripal\Form\TripalEntityForm), Object(Drupal\Core\Form\FormState)) #18 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #19 /var/www/drupal9/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #20 /var/www/drupal9/web/core/lib/Drupal/Core/Render/Renderer.php(564): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\@closure() #21 /var/www/drupal9/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #22 /var/www/drupal9/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #23 /var/www/drupal9/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\@closure() #24 /var/www/drupal9/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #25 /var/www/drupal9/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #26 /var/www/drupal9/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #27 /var/www/drupal9/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #28 /var/www/drupal9/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #29 /var/www/drupal9/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #30 /var/www/drupal9/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #31 /var/www/drupal9/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #32 /var/www/drupal9/web/core/lib/Drupal/Core/DrupalKernel.php(709): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #33 /var/www/drupal9/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #34 @main Next Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "analysisprop_c1" DETAIL: Key (analysis_id, type_id, rank)=(1, 31, 0) already exists.: INSERT INTO "chado"."analysisprop" ("type_id", "analysis_id") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1) RETURNING analysisprop_id; Array ( ) in /var/www/drupal9/web/core/lib/Drupal/Core/Database/ExceptionHandler.php:77 Stack trace: #0 /var/www/drupal9/web/core/modules/pgsql/src/Driver/Database/pgsql/Insert.php(106): Drupal\Core\Database\ExceptionHandler->handleExecutionException(Object(PDOException), Object(Drupal\Core\Database\StatementWrapper), Array, Array) #1 /var/www/drupal9/web/modules/contrib/tripal/tripal_chado/src/Plugin/TripalStorage/ChadoStorage.php(146): Drupal\pgsql\Driver\Database\pgsql\Insert->execute() #2 /var/www/drupal9/web/modules/contrib/tripal/tripal_chado/src/Plugin/TripalStorage/ChadoStorage.php(364): Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage->insertChadoRecord(Array, 'analysisprop', 0, Array) #3 /var/www/drupal9/web/modules/contrib/tripal/tripal/src/Entity/TripalEntity.php(559): Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage->updateValues(Array) #4 /var/www/drupal9/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(562): Drupal\tripal\Entity\TripalEntity->preSave(Object(Drupal\Core\Entity\Sql\SqlContentEntityStorage)) #5 /var/www/drupal9/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(756): Drupal\Core\Entity\EntityStorageBase->doPreSave(Object(Drupal\tripal\Entity\TripalEntity)) #6 /var/www/drupal9/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(517): Drupal\Core\Entity\ContentEntityStorageBase->doPreSave(Object(Drupal\tripal\Entity\TripalEntity)) #7 /var/www/drupal9/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(804): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\tripal\Entity\TripalEntity)) #8 /var/www/drupal9/web/core/lib/Drupal/Core/Entity/EntityBase.php(339): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object(Drupal\tripal\Entity\TripalEntity)) #9 /var/www/drupal9/web/core/lib/Drupal/Core/Entity/EntityForm.php(285): Drupal\Core\Entity\EntityBase->save() #10 /var/www/drupal9/web/modules/contrib/tripal/tripal/src/Form/TripalEntityForm.php(42): Drupal\Core\Entity\EntityForm->save(Array, Object(Drupal\Core\Form\FormState)) #11 [internal function]: Drupal\tripal\Form\TripalEntityForm->save(Array, Object(Drupal\Core\Form\FormState)) #12 /var/www/drupal9/web/core/lib/Drupal/Core/Form/FormSubmitter.php(114): call_user_func_array(Array, Array) #13 /var/www/drupal9/web/core/lib/Drupal/Core/Form/FormSubmitter.php(52): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState)) #14 /var/www/drupal9/web/core/lib/Drupal/Core/Form/FormBuilder.php(592): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState)) #15 /var/www/drupal9/web/core/lib/Drupal/Core/Form/FormBuilder.php(320): Drupal\Core\Form\FormBuilder->processForm('tripal_entity_b...', Array, Object(Drupal\Core\Form\FormState)) #16 /var/www/drupal9/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\tripal\Form\TripalEntityForm), Object(Drupal\Core\Form\FormState)) #17 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #18 /var/www/drupal9/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #19 /var/www/drupal9/web/core/lib/Drupal/Core/Render/Renderer.php(564): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\@closure() #20 /var/www/drupal9/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #21 /var/www/drupal9/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #22 /var/www/drupal9/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\@closure() #23 /var/www/drupal9/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #24 /var/www/drupal9/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #25 /var/www/drupal9/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #26 /var/www/drupal9/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #27 /var/www/drupal9/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #28 /var/www/drupal9/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #29 /var/www/drupal9/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #30 /var/www/drupal9/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #31 /var/www/drupal9/web/core/lib/Drupal/Core/DrupalKernel.php(709): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #32 /var/www/drupal9/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #33 @main
  1. Edit the same genome assembly without changes again. You should get a WSOD/internal error with the following messages in the log:
InvalidArgumentException: Unable to remove item at non-existing index. in Drupal\Core\TypedData\Plugin\DataType\ItemList->removeItem() (line 138 of /var/www/drupal9/web/core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php).

Drupal\Core\Entity\EntityStorageException: Unable to remove item at non-existing index. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 815 of /var/www/drupal9/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

I believed this is fixed with PR #321

Likely fixed in recent PR. Leaving open until it is specifically tested.

I just tested this with the current 9.x-4.x and there were no errors.

Awesome! Thanks for the confirmation!