Slim Application Error: ...SQL: INSERT INTO query_participants > (query_id, user_id)

Hi,
Everytime user submit a new submission,

1- submission dialog pops up and wheel keep spinning (although submission successfully submitted yet windows does not disappear).

2- OJS throws following fatal error:

[06-Apr-2024 14:52:23 Asia/Riyadh] Slim Application Error:
Type: Illuminate\Database\QueryException
Code: 23000
Message: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1957-1' for key 'query_participants_unique' (SQL: INSERT INTO query_participants
(query_id, user_id)
VALUES
(1957, 1))
File: /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php
Line: 760
Trace: #0 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(720): Illuminate\Database\Connection->runQueryCallback()
#1 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(577): Illuminate\Database\Connection->run()
#2 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(469): Illuminate\Database\Connection->affectingStatement()
#3 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(338): Illuminate\Database\DatabaseManager->__call()
#4 /home/seisense/journal.seisense.com/lib/pkp/classes/db/DAO.php(170): Illuminate\Support\Facades\Facade::__callStatic()
#5 /home/seisense/journal.seisense.com/lib/pkp/classes/query/QueryDAO.php(212): PKP\db\DAO->update()
#6 /home/seisense/journal.seisense.com/lib/pkp/classes/query/QueryDAO.php(394): PKP\query\QueryDAO->insertParticipant()
#7 /home/seisense/journal.seisense.com/lib/pkp/classes/query/QueryDAO.php(493): PKP\query\QueryDAO->addQuery()
#8 /home/seisense/journal.seisense.com/lib/pkp/classes/submission/Repository.php(603): PKP\query\QueryDAO->addCommentsForEditorsQuery()
#9 /home/seisense/journal.seisense.com/lib/pkp/api/v1/submissions/PKPSubmissionHandler.php(722): PKP\submission\Repository->submit()
#10 [internal function]: PKP\API\v1\submissions\PKPSubmissionHandler->submit()
#11 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(40): call_user_func()
#12 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/Route.php(281): Slim\Handlers\Strategies\RequestResponse->__invoke()
#13 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\Route->__invoke()
#14 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/Route.php(268): Slim\Route->callMiddlewareStack()
#15 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/App.php(503): Slim\Route->run()
#16 /home/seisense/journal.seisense.com/lib/pkp/classes/security/authorization/internal/ApiAuthorizationMiddleware.php(90): Slim\App->__invoke()
#17 [internal function]: PKP\security\authorization\internal\ApiAuthorizationMiddleware->__invoke()
#18 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()
#19 [internal function]: Slim\DeferredCallable->__invoke()
#20 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()
#21 /home/seisense/journal.seisense.com/lib/pkp/classes/security/authorization/internal/ApiCsrfMiddleware.php(56): Slim\App->Slim{closure}()
#22 [internal function]: PKP\security\authorization\internal\ApiCsrfMiddleware->__invoke()
#23 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()
#24 [internal function]: Slim\DeferredCallable->__invoke()
#25 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()
#26 /home/seisense/journal.seisense.com/lib/pkp/classes/security/authorization/internal/ApiTokenDecodingMiddleware.php(140): Slim\App->Slim{closure}()
#27 [internal function]: PKP\security\authorization\internal\ApiTokenDecodingMiddleware->__invoke()
#28 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()
#29 [internal function]: Slim\DeferredCallable->__invoke()
#30 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()
#31 /home/seisense/journal.seisense.com/lib/pkp/classes/handler/APIHandler.php(83): Slim\App->Slim{closure}()
#32 [internal function]: PKP\handler\APIHandler->PKP\handler{closure}()
#33 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()
#34 [internal function]: Slim\DeferredCallable->__invoke()
#35 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()
#36 /home/seisense/journal.seisense.com/lib/pkp/classes/handler/APIHandler.php(100): Slim\App->Slim{closure}()
#37 [internal function]: PKP\handler\APIHandler->PKP\handler{closure}()
#38 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()
#39 [internal function]: Slim\DeferredCallable->__invoke()
#40 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()
#41 /home/seisense/journal.seisense.com/lib/pkp/classes/handler/APIHandler.php(105): Slim\App->Slim{closure}()
#42 [internal function]: PKP\handler\APIHandler->PKP\handler{closure}()
#43 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()
#44 [internal function]: Slim\DeferredCallable->__invoke()
#45 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()
#46 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\App->Slim{closure}()
#47 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/App.php(392): Slim\App->callMiddlewareStack()
#48 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/App.php(297): Slim\App->process()
#49 /home/seisense/journal.seisense.com/lib/pkp/classes/core/APIRouter.php(110): Slim\App->run()
#50 /home/seisense/journal.seisense.com/lib/pkp/classes/core/Dispatcher.php(165): PKP\core\APIRouter->route()
#51 /home/seisense/journal.seisense.com/lib/pkp/classes/core/PKPApplication.php(388): PKP\core\Dispatcher->dispatch()
#52 /home/seisense/journal.seisense.com/index.php(21): PKP\core\PKPApplication->execute()
#53 {main}
Previous error:
Type: PDOException
Code: 23000
Message: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1957-1' for key 'query_participants_unique'
File: /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php
Line: 570
Trace: #0 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(570): PDOStatement->execute()
#1 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(753): Illuminate\Database\Connection->Illuminate\Database{closure}()
#2 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(720): Illuminate\Database\Connection->runQueryCallback()
#3 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(577): Illuminate\Database\Connection->run()
#4 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(469): Illuminate\Database\Connection->affectingStatement()
#5 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(338): Illuminate\Database\DatabaseManager->__call()
#6 /home/seisense/journal.seisense.com/lib/pkp/classes/db/DAO.php(170): Illuminate\Support\Facades\Facade::__callStatic()
#7 /home/seisense/journal.seisense.com/lib/pkp/classes/query/QueryDAO.php(212): PKP\db\DAO->update()
#8 /home/seisense/journal.seisense.com/lib/pkp/classes/query/QueryDAO.php(394): PKP\query\QueryDAO->insertParticipant()
#9 /home/seisense/journal.seisense.com/lib/pkp/classes/query/QueryDAO.php(493): PKP\query\QueryDAO->addQuery()
#10 /home/seisense/journal.seisense.com/lib/pkp/classes/submission/Repository.php(603): PKP\query\QueryDAO->addCommentsForEditorsQuery()
#11 /home/seisense/journal.seisense.com/lib/pkp/api/v1/submissions/PKPSubmissionHandler.php(722): PKP\submission\Repository->submit()
#12 [internal function]: PKP\API\v1\submissions\PKPSubmissionHandler->submit()
#13 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(40): call_user_func()
#14 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/Route.php(281): Slim\Handlers\Strategies\RequestResponse->__invoke()
#15 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\Route->__invoke()
#16 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/Route.php(268): Slim\Route->callMiddlewareStack()
#17 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/App.php(503): Slim\Route->run()
#18 /home/seisense/journal.seisense.com/lib/pkp/classes/security/authorization/internal/ApiAuthorizationMiddleware.php(90): Slim\App->__invoke()
#19 [internal function]: PKP\security\authorization\internal\ApiAuthorizationMiddleware->__invoke()
#20 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()
#21 [internal function]: Slim\DeferredCallable->__invoke()
#22 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()
#23 /home/seisense/journal.seisense.com/lib/pkp/classes/security/authorization/internal/ApiCsrfMiddleware.php(56): Slim\App->Slim{closure}()
#24 [internal function]: PKP\security\authorization\internal\ApiCsrfMiddleware->__invoke()
#25 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()
#26 [internal function]: Slim\DeferredCallable->__invoke()
#27 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()
#28 /home/seisense/journal.seisense.com/lib/pkp/classes/security/authorization/internal/ApiTokenDecodingMiddleware.php(140): Slim\App->Slim{closure}()
#29 [internal function]: PKP\security\authorization\internal\ApiTokenDecodingMiddleware->__invoke()
#30 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()
#31 [internal function]: Slim\DeferredCallable->__invoke()
#32 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()
#33 /home/seisense/journal.seisense.com/lib/pkp/classes/handler/APIHandler.php(83): Slim\App->Slim{closure}()
#34 [internal function]: PKP\handler\APIHandler->PKP\handler{closure}()
#35 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()
#36 [internal function]: Slim\DeferredCallable->__invoke()
#37 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()
#38 /home/seisense/journal.seisense.com/lib/pkp/classes/handler/APIHandler.php(100): Slim\App->Slim{closure}()
#39 [internal function]: PKP\handler\APIHandler->PKP\handler{closure}()
#40 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()
#41 [internal function]: Slim\DeferredCallable->__invoke()
#42 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()
#43 /home/seisense/journal.seisense.com/lib/pkp/classes/handler/APIHandler.php(105): Slim\App->Slim{closure}()
#44 [internal function]: PKP\handler\APIHandler->PKP\handler{closure}()
#45 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()
#46 [internal function]: Slim\DeferredCallable->__invoke()
#47 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()
#48 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\App->Slim{closure}()
#49 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/App.php(392): Slim\App->callMiddlewareStack()
#50 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/slim/slim/Slim/App.php(297): Slim\App->process()
#51 /home/seisense/journal.seisense.com/lib/pkp/classes/core/APIRouter.php(110): Slim\App->run()
#52 /home/seisense/journal.seisense.com/lib/pkp/classes/core/Dispatcher.php(165): PKP\core\APIRouter->route()
#53 /home/seisense/journal.seisense.com/lib/pkp/classes/core/PKPApplication.php(388): PKP\core\Dispatcher->dispatch()
#54 /home/seisense/journal.seisense.com/index.php(21): PKP\core\PKPApplication->execute()
#55 {main}
View in rendered output by enabling the “displayErrorDetails” setting.

Php: 8.1
OJS: 3.4.0.5

Please help me to resolve this issue.
Thanks
seisense

Hi,
I am also experiencing the exact same issue. Did you manage to fix this? Although the submission get submitted and even the acknowledgment email is also sent, but the wheel keeps spinning and I have noticed that the message for the editor is not shown in the pre-review discussion, Just a blank entry is created without any text. @asmecher Please see if you can help in this.

OJS Version: 3.4.0.7
PHP Version: 8.0.30

Thanks

It looks like the Database has the Duplicate entry,you can find this record and delete it…

Hello :slight_smile:

We are also facing the same issue on our self-hosted OJS :

  • OJS v3.4.0.4
  • Debian 12.7 / PHP 8.0.30 / MariaDB 10.5.23

We tested to upgrade to v3.4.0.5 but the issue is still occurring so we rollback to v3.4.0.4.

I’m not comfortable to delete db records on production website, it acts on the consequence without change the source or identify the source of the bug.

With my tests, it seems that the submission INSERT is called twice, the first one create the record, the second throws the exception with duplicate entry.

Best regards,
Kenny.

Hi all,

Can you try the following change and report back if it resolves the issue?

diff --git a/lib/pkp/classes/query/QueryDAO.php b/lib/pkp/classes/query/QueryDAO.php
index 8d5560438b..3a28139fa8 100644
--- a/lib/pkp/classes/query/QueryDAO.php
+++ b/lib/pkp/classes/query/QueryDAO.php
@@ -390,7 +390,7 @@ class QueryDAO extends \PKP\db\DAO
         $this->insertObject($query);
         $this->resequence(Application::ASSOC_TYPE_SUBMISSION, $submissionId);
 
-        foreach ($participantUserIds as $participantUserId) {
+        foreach (array_unique($participantUserIds) as $participantUserId) {
             $this->insertParticipant($query->getId(), $participantUserId);
         }

Thanks,
Alec Smecher
Public Knowledge Project Team

Hello @asmecher,

Thank you very much for your quick help ! :slight_smile:
I have tested on my staging environment and it solves !

Best regards,
Kenny.

Hi @kcalvat,

Thanks for confirming! I’ve filed and committed this fix here:

Regards,
Alec Smecher
Public Knowledge Project Team

This topic was automatically closed after 10 days. New replies are no longer allowed.