-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'userid' for key 'user_status_uid_ix' #42625
Comments
Also experiencing this - happy to share logs if needed. Nextcloud server 27.1.4 |
Also experiencing this, slightly different error in log.
It seems to me that this starts appearing during events scheduled in the calendar (even though log says 'No app in context'). My status changes to "In a meeting" and I notice a couple of these errors appear. It seems it's got to do something with updating user status in DB? Some kind of conflicting status? Other than the errors, seemingly no functionality is affected. Nextcloud 28.0.1. |
I saw it in the log, too. It happened only once, though, Steps to reproduce Expected behavior Installation method Nextcloud Server version Operating system PHP engine version Web server Database engine version Is this bug present after an update or on a fresh install? Are you using the Nextcloud Server Encryption module? What user-backends are you using? Configuration report List of activated Apps activity: 2.19.0 Nextcloud Logs [no app in context] Error: OC\DB\Exceptions\DbalException: An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '<user_name>' for key 'user_status_uid_ix' at <> /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php line 328 Doctrine\DBAL\Exception\UniqueConstraintViolationException: An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '<user_name>' for key 'user_status_uid_ix' at <> /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php line 1814 Doctrine\DBAL\Driver\PDO\Exception: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '<user_name>' for key 'user_status_uid_ix' at <> /var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php line 103 PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '<user_name>' for key 'user_status_uid_ix' at <> /var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php line 101 Additional info |
It seems to me the the exception has changed. I ran into a similar issue and had to change the exception catch from } catch (Exception $e) {
if ($e->getReason() === Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) { to } catch (Exception $e) {
// TODO: Change exception catch to actual exception
// Currently OC\DB\Exceptions\DbalException is thrown instead of
// UniqueConstraintViolationException
// since the exception is from private namespace, we check the type string
if (get_class($e) === 'OC\DB\Exceptions\DbalException') { in my case this was thrown
|
We can wrap the insert in a try- catch, but the question is why it doesn't find the existing status (thus the unique constrain violation) and updates it instead. Anyone got a full stack trace? |
|
I think this will not fix the Groupfolder issue 😉 since we're looking at the user status. Thanks for the stack trace! |
This still happens on 28.0.2 RC2 {
"reqId": "SvJ2uh2daCaabcddcOqX",
"level": 3,
"time": "2024-01-24T08:22:12+00:00",
"remoteAddr": "109.43.177.131",
"user": "alice",
"app": "no app in context",
"method": "GET",
"url": "/ocs/v2.php/apps/user_status/api/v1/user_status",
"message": "Exception thrown: OC\\DB\\Exceptions\\DbalException",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0",
"version": "28.0.2.2",
"exception": {
"Exception": "OC\\DB\\Exceptions\\DbalException",
"Message": "An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'alice' for key 'user_status_uid_ix'",
"Code": 1062,
"Trace": [
{
"file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
"line": 328,
"function": "wrap",
"class": "OC\\DB\\Exceptions\\DbalException",
"type": "::",
"args": [
[
"Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException"
]
]
},
{
"file": "/var/www/nextcloud/lib/public/AppFramework/Db/QBMapper.php",
"line": 219,
"function": "executeStatement",
"class": "OC\\DB\\QueryBuilder\\QueryBuilder",
"type": "->",
"args": []
},
{
"file": "/var/www/nextcloud/apps/user_status/lib/Service/StatusService.php",
"line": 522,
"function": "update",
"class": "OCP\\AppFramework\\Db\\QBMapper",
"type": "->",
"args": [
"*** sensitive parameters replaced ***"
]
},
{
"file": "/var/www/nextcloud/apps/dav/lib/CalDAV/Status/StatusService.php",
"line": 121,
"function": "revertUserStatus",
"class": "OCA\\UserStatus\\Service\\StatusService",
"type": "->",
"args": [
"alice",
"meeting"
]
},
{
"file": "/var/www/nextcloud/apps/user_status/lib/Controller/UserStatusController.php",
"line": 77,
"function": "processCalendarStatus",
"class": "OCA\\DAV\\CalDAV\\Status\\StatusService",
"type": "->",
"args": [
"alice"
]
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
"line": 230,
"function": "getStatus",
"class": "OCA\\UserStatus\\Controller\\UserStatusController",
"type": "->",
"args": []
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
"line": 137,
"function": "executeController",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->",
"args": [
[
"OCA\\UserStatus\\Controller\\UserStatusController"
],
"getStatus"
]
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
"line": 184,
"function": "dispatch",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->",
"args": [
[
"OCA\\UserStatus\\Controller\\UserStatusController"
],
"getStatus"
]
},
{
"file": "/var/www/nextcloud/lib/private/Route/Router.php",
"line": 315,
"function": "main",
"class": "OC\\AppFramework\\App",
"type": "::",
"args": [
"OCA\\UserStatus\\Controller\\UserStatusController",
"getStatus",
[
"OC\\AppFramework\\DependencyInjection\\DIContainer"
],
[
"ocs.user_status.UserStatus.getStatus"
]
]
},
{
"file": "/var/www/nextcloud/ocs/v1.php",
"line": 65,
"function": "match",
"class": "OC\\Route\\Router",
"type": "->",
"args": [
"/ocsapp/apps/user_status/api/v1/user_status"
]
},
{
"file": "/var/www/nextcloud/ocs/v2.php",
"line": 23,
"args": [
"/var/www/nextcloud/ocs/v1.php"
],
"function": "require_once"
}
],
"File": "/var/www/nextcloud/lib/private/DB/Exceptions/DbalException.php",
"Line": 71,
"Previous": {
"Exception": "Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException",
"Message": "An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'alice' for key 'user_status_uid_ix'",
"Code": 1062,
"Trace": [
{
"file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
"line": 1938,
"function": "convert",
"class": "Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter",
"type": "->",
"args": [
[
"Doctrine\\DBAL\\Driver\\PDO\\Exception"
],
[
"Doctrine\\DBAL\\Query"
]
]
},
{
"file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
"line": 1880,
"function": "handleDriverException",
"class": "Doctrine\\DBAL\\Connection",
"type": "->",
"args": [
[
"Doctrine\\DBAL\\Driver\\PDO\\Exception"
],
[
"Doctrine\\DBAL\\Query"
]
]
},
{
"file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
"line": 1208,
"function": "convertExceptionDuringQuery",
"class": "Doctrine\\DBAL\\Connection",
"type": "->",
"args": [
[
"Doctrine\\DBAL\\Driver\\PDO\\Exception"
],
"UPDATE `oc_user_status` SET `is_backup` = ?, `user_id` = ? WHERE `id` = ?",
[
false,
"alice",
82170
],
[
5,
2,
1
]
]
},
{
"file": "/var/www/nextcloud/lib/private/DB/Connection.php",
"line": 294,
"function": "executeStatement",
"class": "Doctrine\\DBAL\\Connection",
"type": "->",
"args": [
"UPDATE `oc_user_status` SET `is_backup` = ?, `user_id` = ? WHERE `id` = ?",
[
false,
"alice",
82170
],
[
5,
2,
1
]
]
},
{
"file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php",
"line": 386,
"function": "executeStatement",
"class": "OC\\DB\\Connection",
"type": "->",
"args": [
"UPDATE `oc_user_status` SET `is_backup` = :dcValue1, `user_id` = :dcValue2 WHERE `id` = :dcValue3",
[
false,
"alice",
82170
],
[
5,
2,
1
]
]
},
{
"file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
"line": 280,
"function": "execute",
"class": "Doctrine\\DBAL\\Query\\QueryBuilder",
"type": "->",
"args": []
},
{
"file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
"line": 326,
"function": "execute",
"class": "OC\\DB\\QueryBuilder\\QueryBuilder",
"type": "->",
"args": []
},
{
"file": "/var/www/nextcloud/lib/public/AppFramework/Db/QBMapper.php",
"line": 219,
"function": "executeStatement",
"class": "OC\\DB\\QueryBuilder\\QueryBuilder",
"type": "->",
"args": []
},
{
"file": "/var/www/nextcloud/apps/user_status/lib/Service/StatusService.php",
"line": 522,
"function": "update",
"class": "OCP\\AppFramework\\Db\\QBMapper",
"type": "->",
"args": [
"*** sensitive parameters replaced ***"
]
},
{
"file": "/var/www/nextcloud/apps/dav/lib/CalDAV/Status/StatusService.php",
"line": 121,
"function": "revertUserStatus",
"class": "OCA\\UserStatus\\Service\\StatusService",
"type": "->",
"args": [
"alice",
"meeting"
]
},
{
"file": "/var/www/nextcloud/apps/user_status/lib/Controller/UserStatusController.php",
"line": 77,
"function": "processCalendarStatus",
"class": "OCA\\DAV\\CalDAV\\Status\\StatusService",
"type": "->",
"args": [
"alice"
]
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
"line": 230,
"function": "getStatus",
"class": "OCA\\UserStatus\\Controller\\UserStatusController",
"type": "->",
"args": []
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
"line": 137,
"function": "executeController",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->",
"args": [
[
"OCA\\UserStatus\\Controller\\UserStatusController"
],
"getStatus"
]
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
"line": 184,
"function": "dispatch",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->",
"args": [
[
"OCA\\UserStatus\\Controller\\UserStatusController"
],
"getStatus"
]
},
{
"file": "/var/www/nextcloud/lib/private/Route/Router.php",
"line": 315,
"function": "main",
"class": "OC\\AppFramework\\App",
"type": "::",
"args": [
"OCA\\UserStatus\\Controller\\UserStatusController",
"getStatus",
[
"OC\\AppFramework\\DependencyInjection\\DIContainer"
],
[
"ocs.user_status.UserStatus.getStatus"
]
]
},
{
"file": "/var/www/nextcloud/ocs/v1.php",
"line": 65,
"function": "match",
"class": "OC\\Route\\Router",
"type": "->",
"args": [
"/ocsapp/apps/user_status/api/v1/user_status"
]
},
{
"file": "/var/www/nextcloud/ocs/v2.php",
"line": 23,
"args": [
"/var/www/nextcloud/ocs/v1.php"
],
"function": "require_once"
}
],
"File": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php",
"Line": 62,
"Previous": {
"Exception": "Doctrine\\DBAL\\Driver\\PDO\\Exception",
"Message": "SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'alice' for key 'user_status_uid_ix'",
"Code": 1062,
"Trace": [
{
"file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
"line": 132,
"function": "new",
"class": "Doctrine\\DBAL\\Driver\\PDO\\Exception",
"type": "::",
"args": [
[
"PDOException",
[
"23000",
1062,
"Duplicate entry 'alice' for key 'user_status_uid_ix'"
]
]
]
},
{
"file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
"line": 1202,
"function": "execute",
"class": "Doctrine\\DBAL\\Driver\\PDO\\Statement",
"type": "->",
"args": []
},
{
"file": "/var/www/nextcloud/lib/private/DB/Connection.php",
"line": 294,
"function": "executeStatement",
"class": "Doctrine\\DBAL\\Connection",
"type": "->",
"args": [
"UPDATE `oc_user_status` SET `is_backup` = ?, `user_id` = ? WHERE `id` = ?",
[
false,
"alice",
82170
],
[
5,
2,
1
]
]
},
{
"file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php",
"line": 386,
"function": "executeStatement",
"class": "OC\\DB\\Connection",
"type": "->",
"args": [
"UPDATE `oc_user_status` SET `is_backup` = :dcValue1, `user_id` = :dcValue2 WHERE `id` = :dcValue3",
[
false,
"alice",
82170
],
[
5,
2,
1
]
]
},
{
"file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
"line": 280,
"function": "execute",
"class": "Doctrine\\DBAL\\Query\\QueryBuilder",
"type": "->",
"args": []
},
{
"file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
"line": 326,
"function": "execute",
"class": "OC\\DB\\QueryBuilder\\QueryBuilder",
"type": "->",
"args": []
},
{
"file": "/var/www/nextcloud/lib/public/AppFramework/Db/QBMapper.php",
"line": 219,
"function": "executeStatement",
"class": "OC\\DB\\QueryBuilder\\QueryBuilder",
"type": "->",
"args": []
},
{
"file": "/var/www/nextcloud/apps/user_status/lib/Service/StatusService.php",
"line": 522,
"function": "update",
"class": "OCP\\AppFramework\\Db\\QBMapper",
"type": "->",
"args": [
"*** sensitive parameters replaced ***"
]
},
{
"file": "/var/www/nextcloud/apps/dav/lib/CalDAV/Status/StatusService.php",
"line": 121,
"function": "revertUserStatus",
"class": "OCA\\UserStatus\\Service\\StatusService",
"type": "->",
"args": [
"alice",
"meeting"
]
},
{
"file": "/var/www/nextcloud/apps/user_status/lib/Controller/UserStatusController.php",
"line": 77,
"function": "processCalendarStatus",
"class": "OCA\\DAV\\CalDAV\\Status\\StatusService",
"type": "->",
"args": [
"alice"
]
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
"line": 230,
"function": "getStatus",
"class": "OCA\\UserStatus\\Controller\\UserStatusController",
"type": "->",
"args": []
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
"line": 137,
"function": "executeController",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->",
"args": [
[
"OCA\\UserStatus\\Controller\\UserStatusController"
],
"getStatus"
]
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
"line": 184,
"function": "dispatch",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->",
"args": [
[
"OCA\\UserStatus\\Controller\\UserStatusController"
],
"getStatus"
]
},
{
"file": "/var/www/nextcloud/lib/private/Route/Router.php",
"line": 315,
"function": "main",
"class": "OC\\AppFramework\\App",
"type": "::",
"args": [
"OCA\\UserStatus\\Controller\\UserStatusController",
"getStatus",
[
"OC\\AppFramework\\DependencyInjection\\DIContainer"
],
[
"ocs.user_status.UserStatus.getStatus"
]
]
},
{
"file": "/var/www/nextcloud/ocs/v1.php",
"line": 65,
"function": "match",
"class": "OC\\Route\\Router",
"type": "->",
"args": [
"/ocsapp/apps/user_status/api/v1/user_status"
]
},
{
"file": "/var/www/nextcloud/ocs/v2.php",
"line": 23,
"args": [
"/var/www/nextcloud/ocs/v1.php"
],
"function": "require_once"
}
],
"File": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php",
"Line": 28,
"Previous": {
"Exception": "PDOException",
"Message": "SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'alice' for key 'user_status_uid_ix'",
"Code": "23000",
"Trace": [
{
"file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
"line": 130,
"function": "execute",
"class": "PDOStatement",
"type": "->",
"args": [
null
]
},
{
"file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
"line": 1202,
"function": "execute",
"class": "Doctrine\\DBAL\\Driver\\PDO\\Statement",
"type": "->",
"args": []
},
{
"file": "/var/www/nextcloud/lib/private/DB/Connection.php",
"line": 294,
"function": "executeStatement",
"class": "Doctrine\\DBAL\\Connection",
"type": "->",
"args": [
"UPDATE `oc_user_status` SET `is_backup` = ?, `user_id` = ? WHERE `id` = ?",
[
false,
"alice",
82170
],
[
5,
2,
1
]
]
},
{
"file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php",
"line": 386,
"function": "executeStatement",
"class": "OC\\DB\\Connection",
"type": "->",
"args": [
"UPDATE `oc_user_status` SET `is_backup` = :dcValue1, `user_id` = :dcValue2 WHERE `id` = :dcValue3",
[
false,
"alice",
82170
],
[
5,
2,
1
]
]
},
{
"file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
"line": 280,
"function": "execute",
"class": "Doctrine\\DBAL\\Query\\QueryBuilder",
"type": "->",
"args": []
},
{
"file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
"line": 326,
"function": "execute",
"class": "OC\\DB\\QueryBuilder\\QueryBuilder",
"type": "->",
"args": []
},
{
"file": "/var/www/nextcloud/lib/public/AppFramework/Db/QBMapper.php",
"line": 219,
"function": "executeStatement",
"class": "OC\\DB\\QueryBuilder\\QueryBuilder",
"type": "->",
"args": []
},
{
"file": "/var/www/nextcloud/apps/user_status/lib/Service/StatusService.php",
"line": 522,
"function": "update",
"class": "OCP\\AppFramework\\Db\\QBMapper",
"type": "->",
"args": [
"*** sensitive parameters replaced ***"
]
},
{
"file": "/var/www/nextcloud/apps/dav/lib/CalDAV/Status/StatusService.php",
"line": 121,
"function": "revertUserStatus",
"class": "OCA\\UserStatus\\Service\\StatusService",
"type": "->",
"args": [
"alice",
"meeting"
]
},
{
"file": "/var/www/nextcloud/apps/user_status/lib/Controller/UserStatusController.php",
"line": 77,
"function": "processCalendarStatus",
"class": "OCA\\DAV\\CalDAV\\Status\\StatusService",
"type": "->",
"args": [
"alice"
]
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
"line": 230,
"function": "getStatus",
"class": "OCA\\UserStatus\\Controller\\UserStatusController",
"type": "->",
"args": []
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
"line": 137,
"function": "executeController",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->",
"args": [
[
"OCA\\UserStatus\\Controller\\UserStatusController"
],
"getStatus"
]
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
"line": 184,
"function": "dispatch",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->",
"args": [
[
"OCA\\UserStatus\\Controller\\UserStatusController"
],
"getStatus"
]
},
{
"file": "/var/www/nextcloud/lib/private/Route/Router.php",
"line": 315,
"function": "main",
"class": "OC\\AppFramework\\App",
"type": "::",
"args": [
"OCA\\UserStatus\\Controller\\UserStatusController",
"getStatus",
[
"OC\\AppFramework\\DependencyInjection\\DIContainer"
],
[
"ocs.user_status.UserStatus.getStatus"
]
]
},
{
"file": "/var/www/nextcloud/ocs/v1.php",
"line": 65,
"function": "match",
"class": "OC\\Route\\Router",
"type": "->",
"args": [
"/ocsapp/apps/user_status/api/v1/user_status"
]
},
{
"file": "/var/www/nextcloud/ocs/v2.php",
"line": 23,
"args": [
"/var/www/nextcloud/ocs/v1.php"
],
"function": "require_once"
}
],
"File": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
"Line": 130
}
}
},
"CustomMessage": "Exception thrown: OC\\DB\\Exceptions\\DbalException"
},
"id": "65b0c8cd80ecc"
} |
This time it's the revert apparently |
Also having that Issue: DbalException An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'admin_username' for key 'user_status_uid_ix' Nextcloud Hub 7 (28.0.1) |
same issue here on: |
Bug description
I don't know (yet).
Log (sentry) says
Steps to reproduce
Expected behavior
No error
Installation method
None
Nextcloud Server version
28
Operating system
None
PHP engine version
None
Web server
None
Database engine version
None
Is this bug present after an update or on a fresh install?
None
Are you using the Nextcloud Server Encryption module?
None
What user-backends are you using?
Configuration report
No response
List of activated Apps
No response
Nextcloud Signing status
No response
Nextcloud Logs
No response
Additional info
More error details in https://nextcloud-gmbh.sentry.io/issues/4628540536
The text was updated successfully, but these errors were encountered: