Skip to content
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

Backends provided no user object / Duplicate entry for key 'gf_versions_uniq_index' #2559

Closed
vidlb opened this issue Sep 17, 2023 · 124 comments · Fixed by #2758
Closed

Backends provided no user object / Duplicate entry for key 'gf_versions_uniq_index' #2559

vidlb opened this issue Sep 17, 2023 · 124 comments · Fixed by #2758
Assignees
Labels
1. to develop Issues that are ready for development bug feature: versions Items related to file versioning

Comments

@vidlb
Copy link

vidlb commented Sep 17, 2023

Steps to reproduce

Error appears in the logs with cron jobs, or when using docker run (...) occ groupfolders:expire -v

=> That was the only step to reproduce the "backends provided no user object" error (prior to update 15.3.2 - 16.0.1).
Regarding "duplicate entry for key", see 4 comments starting from #2559 (comment)

Actual behaviour

In Root.php line 364:
  [OC\User\NoUserException] Backends provided no user object

Server configuration

Operating system:
Debian 12 / Docker 24

Web server:
Nginx reverse proxy

Nextcloud version:
27.1

Group folders version:
15.3

Updated from an older Nextcloud/ownCloud or fresh install:
Updated from 27.0

Where did you install Nextcloud from:
Nextcloud AIO

Are you using external storage, if yes which one: local/s3/smb/sftp/...
No

Are you using encryption: yes/no
No

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/Saml/...
No

Logs (docker run)

Exception trace:
  at /var/www/html/lib/private/Files/Node/Root.php:364
 OC\Files\Node\Root->getUserFolder() at n/a:n/a
 call_user_func_array() at /var/www/html/lib/private/Files/Node/LazyFolder.php:74
 OC\Files\Node\LazyFolder->__call() at /var/www/html/lib/private/Files/Node/LazyRoot.php:40
 OC\Files\Node\LazyRoot->getUserFolder() at /var/www/html/custom_apps/groupfolders/lib/Versions/VersionsBackend.php:73
 OCA\GroupFolders\Versions\VersionsBackend->getVersionsForFile() at /var/www/html/custom_apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php:72
 OCA\GroupFolders\Versions\GroupVersionsExpireManager->expireFolder() at /var/www/html/custom_apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php:59
 OCA\GroupFolders\Versions\GroupVersionsExpireManager->expireAll() at /var/www/html/custom_apps/groupfolders/lib/Command/ExpireGroup/ExpireGroupVersions.php:66
 OCA\GroupFolders\Command\ExpireGroup\ExpireGroupVersions->execute() at /var/www/html/custom_apps/groupfolders/lib/Command/ExpireGroup/ExpireGroupVersionsTrash.php:54
 OCA\GroupFolders\Command\ExpireGroup\ExpireGroupVersionsTrash->execute() at /var/www/html/3rdparty/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at /var/www/html/core/Command/Base.php:177
 OC\Core\Command\Base->run() at /var/www/html/3rdparty/symfony/console/Application.php:1040
 Symfony\Component\Console\Application->doRunCommand() at /var/www/html/3rdparty/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at /var/www/html/3rdparty/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at /var/www/html/lib/private/Console/Application.php:211
 OC\Console\Application->run() at /var/www/html/console.php:100
 require_once() at /var/www/html/occ:11

Logs (cron errors in nextcloud admin panel)

Error	core
OC\User\NoUserException: Backends provided no user object
    <<closure>>
    OC\Files\Node\Root->getUserFolder("")

    /var/www/html/lib/private/Files/Node/LazyFolder.php - line 74:
    call_user_func_array([ [ "OC\\Fil ... "], [ ""])

    /var/www/html/lib/private/Files/Node/LazyRoot.php - line 40:
    OC\Files\Node\LazyFolder->__call("getUserFolder", [ ""])

    /var/www/html/custom_apps/groupfolders/lib/Versions/VersionsBackend.php - line 73:
    OC\Files\Node\LazyRoot->getUserFolder("")

    /var/www/html/custom_apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php - line 72:
    OCA\GroupFolders\Versions\VersionsBackend->getVersionsForFile([ "OC\\User\\User"], [ "OC\\Files\\FileInfo"])

    /var/www/html/custom_apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php - line 59:
    OCA\GroupFolders\Versions\GroupVersionsExpireManager->expireFolder([ 2,"LaTeleS ... "])

    /var/www/html/custom_apps/groupfolders/lib/BackgroundJob/ExpireGroupVersions.php - line 43:
    OCA\GroupFolders\Versions\GroupVersionsExpireManager->expireAll()

    /var/www/html/lib/public/BackgroundJob/Job.php - line 81:
    OCA\GroupFolders\BackgroundJob\ExpireGroupVersions->run(null)

    /var/www/html/lib/public/BackgroundJob/TimedJob.php - line 103:
    OCP\BackgroundJob\Job->start([ "OC\\BackgroundJob\\JobList"])

    /var/www/html/lib/public/BackgroundJob/TimedJob.php - line 93:
    OCP\BackgroundJob\TimedJob->start([ "OC\\BackgroundJob\\JobList"])

    /var/www/html/cron.php - line 152:
    OCP\BackgroundJob\TimedJob->execute([ "OC\\BackgroundJob\\JobList"], [ "OC\\Log"])

The bug

It seems the error is due to this line where getVersionsForFile is called with a dummy user, which isn't implemented (yet ?) since getVersionsForFile is clearly requiring a real user, because it will call $user->getUID() which will return NULL and then cause the exception with OC\Files\Node\Root->getUserFolder("")

I couldn't find existing issues, but may be this is something already fixed in master / targeting nextcloud 28 ?
Will it disappear when AIO switch to NC 28 ?

@vidlb vidlb added 0. Needs triage Issues that need to be triaged bug labels Sep 17, 2023
@vidlb vidlb changed the title OCC expire command fails because "Backends provided no user object" Logs filled with cron errors "Backends provided no user object" Sep 17, 2023
@ernolf
Copy link

ernolf commented Sep 17, 2023

Same here.
Discussed --> here <-- as well.

@solracsf
Copy link
Member

@artonge seems related to #2543

@artonge artonge self-assigned this Sep 18, 2023
@artonge artonge moved this to 📄 To do (~10 entries) in 📁 Files team Sep 18, 2023
@solracsf solracsf added 1. to develop Issues that are ready for development feature: versions Items related to file versioning and removed 0. Needs triage Issues that need to be triaged labels Sep 18, 2023
@Anth0nyME

This comment was marked as spam.

@Rednox

This comment was marked as spam.

@alphasixtyfive

This comment was marked as spam.

@Githopp192

This comment was marked as spam.

@Dennis1993

This comment was marked as spam.

@major-mayer
Copy link

To silence this error and get rid of the log spam, I commented out all of this in the function, because it will crash anyway.

      /**
         * @param array{id: int, mount_point: string, groups: array<empty, empty>|array<array-key, int>, quota: int, size: int, acl: bool} $folder
         */
        public function expireFolder(array $folder): void {
                $view = new View('/__groupfolders/versions/' . $folder['id']);
                $files = $this->versionsBackend->getAllVersionedFiles($folder);
                $dummyUser = new User('', null, $this->dispatcher);
                foreach ($files as $fileId => $file) {
                        if ($file instanceof FileInfo) {
                                //$versions = $this->versionsBackend->getVersionsForFile($dummyUser, $file);
                                //$expireVersions = $this->expireManager->getExpiredVersion($versions, $this->timeFactory->getTime(), false);
                                //foreach ($expireVersions as $version) {
                                //      /** @var GroupVersion $version */
                                //      $this->emit(self::class, 'deleteVersion', [$version]);
                                //      $view->unlink('/' . $fileId . '/' . $version->getVersionFile()->getName());
                                //}
                        } else {
                                // source file no longer exists
                                $this->emit(self::class, 'deleteFile', [$fileId]);
                                $this->versionsBackend->deleteAllVersionsForFile($folder['id'], $fileId);
                        }
                }
        }
}

@ostasevych
Copy link

ostasevych commented Nov 19, 2023

To silence this error and get rid of the log spam, I commented out all of this in the function, because it will crash anyway.

      /**
         * @param array{id: int, mount_point: string, groups: array<empty, empty>|array<array-key, int>, quota: int, size: int, acl: bool} $folder
         */
        public function expireFolder(array $folder): void {
                $view = new View('/__groupfolders/versions/' . $folder['id']);
                $files = $this->versionsBackend->getAllVersionedFiles($folder);
                $dummyUser = new User('', null, $this->dispatcher);
                foreach ($files as $fileId => $file) {
                        if ($file instanceof FileInfo) {
                                //$versions = $this->versionsBackend->getVersionsForFile($dummyUser, $file);
                                //$expireVersions = $this->expireManager->getExpiredVersion($versions, $this->timeFactory->getTime(), false);
                                //foreach ($expireVersions as $version) {
                                //      /** @var GroupVersion $version */
                                //      $this->emit(self::class, 'deleteVersion', [$version]);
                                //      $view->unlink('/' . $fileId . '/' . $version->getVersionFile()->getName());
                                //}
                        } else {
                                // source file no longer exists
                                $this->emit(self::class, 'deleteFile', [$fileId]);
                                $this->versionsBackend->deleteAllVersionsForFile($folder['id'], $fileId);
                        }
                }
        }
}

You mean in the file apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php ?
Are any side effects of commenting out this part of the function?

@chrissi55
Copy link

Are any side effects of commenting out this part of the function?

That is an interesting question, as well as if there might be any interference with the files integrity check after updates so as the upcoming 27.1.4 in 2 or 3 days ...

@BJKle
Copy link

BJKle commented Dec 12, 2023

New release no luck. Still the same errors. (nextcloud 28 / groupfolders 16)
no fun :-(

@solracsf
Copy link
Member

solracsf commented Dec 13, 2023

There is a fix undergoing here : #2640

@artonge
Copy link
Contributor

artonge commented Dec 13, 2023

Any chance one of you could give it a try?

@Chartman123
Copy link
Contributor

@artonge Is this fix only for NC28? I can't update my instances currently because of missing app updates...

@rakekniven

This comment was marked as off-topic.

@ostasevych
Copy link

ostasevych commented Jan 12, 2024

I can confirm this duplicate key error with NC 27.1.5

I was able to fix the problem using @ernolf solution: manually removed the only problematic file (from user folder then trash) - using occ so the db / index can be updated. Thanks !

I've found easier way: if you have to fix a lot of files in one folder, you may just rename that folder, expire and rename again.
If a file in the trashbin has gone, and there is still the record in the filecache on it, just MySQL delete that record and expire again.

@vasyugan
Copy link

vasyugan commented Jan 14, 2024

Please stop off-topic comments. For general discussions like this one head over to the forums on https://help.nextcloud.com

I don't feel that the help forum is appropriate at all, because this is not about users doing something wrong that can be corrected by other users, but this is a systemic issue with the Nextcloud project that plagues the groupfolders app more than others. The right place for discussing it seems to be #1215

@brievenbusalex
Copy link

brievenbusalex commented Jan 14, 2024

I also experienced this error and after some searching I found a tricky workaround to get rid of the error (not recommended on production sites !).
Hopefully this helps solving this issue.
(I am using NC 27.1.5 on Almalinux 8, php 8.2, Mariadb 10.11.6)

For me the problem/error starts when moving files from a groupfolder to a normal folder (with the standard move of copy dialog of the nextcloud functionality)

  • When a file is moved from a groupfolder to a normal folder, the file_id is still existing in the table oc_groupfolders_versions
  • The versions are not deleted from the oc_groupfolders_versions database table and not from the filesystem folder __groupfolders/versions/9/.
  • Apparently this causes somehow the error, The cronjob script is trying to recreate (insert) a version which exists on the filesystem but already exists in the database. The unique index gf_versions_uniq_index on the table oc_groupfolders_versions prevents the insert of the same file_id and timestamp.
  • When I moved the file back to the groupfolder the error was gone.
  • Then I moved it back to the normal folder, the error was back again
  • When i manually removed the specific groupfolder version files from the filesystem the error was also gone.
  • I noted while testing the moving back an forth a file from a groupfolder to a normal folder that the cleanup of the file versions is not correctly working, the database entries are not removed from oc_files_versions or oc_group_folders_versions and also version files on the filesytem are not always removed.
  • When totally deleting the testfile, also from the trashbin, I could still find the fileid's in one of the versions tables and on the filesystem fileid folder.

For me the errors are gone now, but only with risky manual deletions in the database and filesystem.
So this should be solved, and maybe introduce a occ groupfolders_files:cleanup for orphan groupfolder versions.

  • More explenation: in nextcloud there is seperate file-versioning functionality for groupfolders and non-groupfolders files (normal folders)
    This difference can be found in the database and on the filesystem
    • non-group folders files (normal folders)
      • database table: oc_files_versions (search versions on fileid)
      • file system /files_versions//.v
        search in filesytem filename and/or on unix timestamp
        e.g. # find -name v1705161442
        ./alexnc/files_versions/Test/test.md.v1705161442
    • groupfolder files
      • database table: oc_group_folders_versions (search versions on file_id)
      • filesystem: versions are stored in directory named
      • search in filesystem on fileid direcory: eg find -name 594693
        e.g. # find -name 594693
        ./__groupfolders/versions/9/594693

Running the occ command manually for checking if the error still exists:
sudo -u apache php -f /var/www/nextcloud/occ groupfolders:expire

Some check queries if this is also the case in your nextcloud environment, if you get results from them then you got a problem :)

//search for fileids in oc_files_versions and not existing in oc_file_cache
select * from oc_files_versions fv where not exists (select 1 from oc_filecache fc where fv.file_id = fc.fileid);

// search fileids in oc_group_folder_versions and not existing in oc_file_cache
select * from oc_group_folders_versions gv where not exists (select 1 from oc_filecache fc where gv.file_id = fc.fileid)

// search for fileid's in non groupfolders but do exist in oc_group_folders_versions
SELECT fileid,
storage,
path,
parent,
name,
storage_mtime,
g.timestamp as time_gversion,
v.timestamp as time_vversion
FROM oc_filecache f left join oc_files_versions v on f.fileid = v.file_id, oc_group_folders_versions g where f.fileid = g.file_id and path not like '__groupfolders/%';

@small1
Copy link

small1 commented Jan 15, 2024

Ok this is happening on several of my instances. If i delete one file with the problem it moves on to the next. The files are unique in the database from what i can see. This prevents cron jobs from running properly.

@small1
Copy link

small1 commented Jan 15, 2024

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '120589-1702287459' for key 'gf_versions_uniq_index'

Stacktrace is similar to others in here.

@miaulalala
Copy link
Collaborator

So is the error actually a unique constraint violation? Can anyone dig in and find if there is an actual duplicate key?

@small1
Copy link

small1 commented Jan 15, 2024

An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '120589-1702287459' for key 'gf_versions_uniq_index'

MariaDB [nextcloud]> select * from oc_group_folders_versions where file_id="120589" and timestamp="1702287459";
+-----+---------+------------+------+----------+----------+
| id | file_id | timestamp | size | mimetype | metadata |
+-----+---------+------------+------+----------+----------+
| 144 | 120589 | 1702287459 | 8265 | 6 | [] |
+-----+---------+------------+------+----------+----------+

From the index it show that file_id and timestamp should be unique and i cant find a duplicate on that file it shows.

@small1
Copy link

small1 commented Jan 15, 2024

And some of the files are even unlikely to have a version. Like recordings for example.

@marcotrevisan
Copy link

How can the duplicity condition come true in the database? The 'gf_versions_uniq_index' constraint is there to avoid it...

@brievenbusalex
Copy link

brievenbusalex commented Jan 15, 2024

As I tried to explain in my earlier post the cron job script (call in the end VersionsBackend.php) is trying to insert a new row in oc_group_folders_versions, based in the file it finds on the filesystem.
The unique index 'gf_versions_uniq_index' prevents getting duplicity in de DB, because there is already a record for this version with the same fileid and timestamp.

But the real question is why is the script VersionsBackend.php trying to do this insert again ? In my case (see my earlier comment) I moved a file from a groupfolder to a normal folder, and the versions in the database for this fileid where not removed from the dbtable oc_group_folders_versions and not remove from the groupfolder's filesystem.

That causes inconsistent versions and the error.

Hope this helps, I am not capable of making changes in the scipts, I am only the messenger...

@small1
Copy link

small1 commented Jan 15, 2024

Well an expire is being run. So it should delete versions not add new ones. ill check the stacktrace again.

@small1
Copy link

small1 commented Jan 15, 2024

Ok so lib/Versions/VersionsBackend.php public function function getVersionsForFile on line 62 runs on line 88 an insert for the current version. That one already has an entry and fails.

@small1
Copy link

small1 commented Jan 15, 2024

{
"reqId":"cYDPBmuVlmSTbUScVQJA",
"level":3,
"time":"2024-01-15T10:55:02+00:00",
"remoteAddr":"",
"user":"--",
"app":"core",
"method":"",
"url":"--",
"message":"Error while running background job (class: OCA\\GroupFolders\\BackgroundJob\\ExpireGroupVersions, arguments: )",
"userAgent":"--",
"version":"28.0.1.1",
"exception":{
"Exception":"OC\\DB\\Exceptions\\DbalException",
"Message":"An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '117161-1701149347' for key 'gf_versions_uniq_index'",
"Code":1062,
"Trace":[
{
"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
"line":328,
"function":"wrap",
"class":"OC\\DB\\Exceptions\\DbalException",
"type":"::"
},
{
"file":"/var/www/nextcloud/lib/public/AppFramework/Db/QBMapper.php",
"line":137,
"function":"executeStatement",
"class":"OC\\DB\\QueryBuilder\\QueryBuilder",
"type":"->"
},
{
"file":"/var/www/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php",
"line":88,
"function":"insert",
"class":"OCP\\AppFramework\\Db\\QBMapper",
"type":"->"
},
{
"file":"/var/www/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php",
"line":72,
"function":"getVersionsForFile",
"class":"OCA\\GroupFolders\\Versions\\VersionsBackend",
"type":"->"
},
{
"file":"/var/www/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php",
"line":59,
"function":"expireFolder",
"class":"OCA\\GroupFolders\\Versions\\GroupVersionsExpireManager",
"type":"->"
},
{
"file":"/var/www/nextcloud/apps/groupfolders/lib/BackgroundJob/ExpireGroupVersions.php",
"line":43,
"function":"expireAll",
"class":"OCA\\GroupFolders\\Versions\\GroupVersionsExpireManager",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/public/BackgroundJob/Job.php",
"line":81,
"function":"run",
"class":"OCA\\GroupFolders\\BackgroundJob\\ExpireGroupVersions",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php",
"line":102,
"function":"start",
"class":"OCP\\BackgroundJob\\Job",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php",
"line":92,
"function":"start",
"class":"OCP\\BackgroundJob\\TimedJob",
"type":"->"
},
{
"file":"/var/www/nextcloud/cron.php",
"line":152,
"function":"execute",
"class":"OCP\\BackgroundJob\\TimedJob",
"type":"->"
}
],
"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 '117161-1701149347' for key 'gf_versions_uniq_index'",
"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":"->"
},
{
"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
"line":1880,
"function":"handleDriverException",
"class":"Doctrine\\DBAL\\Connection",
"type":"->"
},
{
"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
"line":1208,
"function":"convertExceptionDuringQuery",
"class":"Doctrine\\DBAL\\Connection",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/private/DB/Connection.php",
"line":294,
"function":"executeStatement",
"class":"Doctrine\\DBAL\\Connection",
"type":"->"
},
{
"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php",
"line":386,
"function":"executeStatement",
"class":"OC\\DB\\Connection",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
"line":280,
"function":"execute",
"class":"Doctrine\\DBAL\\Query\\QueryBuilder",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
"line":326,
"function":"execute",
"class":"OC\\DB\\QueryBuilder\\QueryBuilder",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/public/AppFramework/Db/QBMapper.php",
"line":137,
"function":"executeStatement",
"class":"OC\\DB\\QueryBuilder\\QueryBuilder",
"type":"->"
},
{
"file":"/var/www/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php",
"line":88,
"function":"insert",
"class":"OCP\\AppFramework\\Db\\QBMapper",
"type":"->"
},
{
"file":"/var/www/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php",
"line":72,
"function":"getVersionsForFile",
"class":"OCA\\GroupFolders\\Versions\\VersionsBackend",
"type":"->"
},
{
"file":"/var/www/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php",
"line":59,
"function":"expireFolder",
"class":"OCA\\GroupFolders\\Versions\\GroupVersionsExpireManager",
"type":"->"
},
{
"file":"/var/www/nextcloud/apps/groupfolders/lib/BackgroundJob/ExpireGroupVersions.php",
"line":43,
"function":"expireAll",
"class":"OCA\\GroupFolders\\Versions\\GroupVersionsExpireManager",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/public/BackgroundJob/Job.php",
"line":81,
"function":"run",
"class":"OCA\\GroupFolders\\BackgroundJob\\ExpireGroupVersions",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php",
"line":102,
"function":"start",
"class":"OCP\\BackgroundJob\\Job",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php",
"line":92,
"function":"start",
"class":"OCP\\BackgroundJob\\TimedJob",
"type":"->"
},
{
"file":"/var/www/nextcloud/cron.php",
"line":152,
"function":"execute",
"class":"OCP\\BackgroundJob\\TimedJob",
"type":"->"
}
],
"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 '117161-1701149347' for key 'gf_versions_uniq_index'",
"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":"::"
},
{
"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
"line":1202,
"function":"execute",
"class":"Doctrine\\DBAL\\Driver\\PDO\\Statement",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/private/DB/Connection.php",
"line":294,
"function":"executeStatement",
"class":"Doctrine\\DBAL\\Connection",
"type":"->"
},
{
"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php",
"line":386,
"function":"executeStatement",
"class":"OC\\DB\\Connection",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
"line":280,
"function":"execute",
"class":"Doctrine\\DBAL\\Query\\QueryBuilder",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
"line":326,
"function":"execute",
"class":"OC\\DB\\QueryBuilder\\QueryBuilder",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/public/AppFramework/Db/QBMapper.php",
"line":137,
"function":"executeStatement",
"class":"OC\\DB\\QueryBuilder\\QueryBuilder",
"type":"->"
},
{
"file":"/var/www/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php",
"line":88,
"function":"insert",
"class":"OCP\\AppFramework\\Db\\QBMapper",
"type":"->"
},
{
"file":"/var/www/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php",
"line":72,
"function":"getVersionsForFile",
"class":"OCA\\GroupFolders\\Versions\\VersionsBackend",
"type":"->"
},
{
"file":"/var/www/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php",
"line":59,
"function":"expireFolder",
"class":"OCA\\GroupFolders\\Versions\\GroupVersionsExpireManager",
"type":"->"
},
{
"file":"/var/www/nextcloud/apps/groupfolders/lib/BackgroundJob/ExpireGroupVersions.php",
"line":43,
"function":"expireAll",
"class":"OCA\\GroupFolders\\Versions\\GroupVersionsExpireManager",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/public/BackgroundJob/Job.php",
"line":81,
"function":"run",
"class":"OCA\\GroupFolders\\BackgroundJob\\ExpireGroupVersions",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php",
"line":102,
"function":"start",
"class":"OCP\\BackgroundJob\\Job",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php",
"line":92,
"function":"start",
"class":"OCP\\BackgroundJob\\TimedJob",
"type":"->"
},
{
"file":"/var/www/nextcloud/cron.php",
"line":152,
"function":"execute",
"class":"OCP\\BackgroundJob\\TimedJob",
"type":"->"
}
],
"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 '117161-1701149347' for key 'gf_versions_uniq_index'",
"Code":"23000",
"Trace":[
{
"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
"line":130,
"function":"execute",
"class":"PDOStatement",
"type":"->"
},
{
"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
"line":1202,
"function":"execute",
"class":"Doctrine\\DBAL\\Driver\\PDO\\Statement",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/private/DB/Connection.php",
"line":294,
"function":"executeStatement",
"class":"Doctrine\\DBAL\\Connection",
"type":"->"
},
{
"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php",
"line":386,
"function":"executeStatement",
"class":"OC\\DB\\Connection",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
"line":280,
"function":"execute",
"class":"Doctrine\\DBAL\\Query\\QueryBuilder",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
"line":326,
"function":"execute",
"class":"OC\\DB\\QueryBuilder\\QueryBuilder",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/public/AppFramework/Db/QBMapper.php",
"line":137,
"function":"executeStatement",
"class":"OC\\DB\\QueryBuilder\\QueryBuilder",
"type":"->"
},
{
"file":"/var/www/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php",
"line":88,
"function":"insert",
"class":"OCP\\AppFramework\\Db\\QBMapper",
"type":"->"
},
{
"file":"/var/www/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php",
"line":72,
"function":"getVersionsForFile",
"class":"OCA\\GroupFolders\\Versions\\VersionsBackend",
"type":"->"
},
{
"file":"/var/www/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php",
"line":59,
"function":"expireFolder",
"class":"OCA\\GroupFolders\\Versions\\GroupVersionsExpireManager",
"type":"->"
},
{
"file":"/var/www/nextcloud/apps/groupfolders/lib/BackgroundJob/ExpireGroupVersions.php",
"line":43,
"function":"expireAll",
"class":"OCA\\GroupFolders\\Versions\\GroupVersionsExpireManager",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/public/BackgroundJob/Job.php",
"line":81,
"function":"run",
"class":"OCA\\GroupFolders\\BackgroundJob\\ExpireGroupVersions",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php",
"line":102,
"function":"start",
"class":"OCP\\BackgroundJob\\Job",
"type":"->"
},
{
"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php",
"line":92,
"function":"start",
"class":"OCP\\BackgroundJob\\TimedJob",
"type":"->"
},
{
"file":"/var/www/nextcloud/cron.php",
"line":152,
"function":"execute",
"class":"OCP\\BackgroundJob\\TimedJob",
"type":"->"
}
],
"File":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
"Line":130
}
}
},
"message":"Error while running background job (class: OCA\\GroupFolders\\BackgroundJob\\ExpireGroupVersions, arguments: )",
"exception":{
},
"CustomMessage":"Error while running background job (class: OCA\\GroupFolders\\BackgroundJob\\ExpireGroupVersions, arguments: )"
}
}

@miaulalala
Copy link
Collaborator

I think the fix for nextcloud/server#42805 applies here too. The read / write split can cause this issue. We could simply catch the unique constrain violation since the entry that is needed is there.

@artonge
Copy link
Contributor

artonge commented Jan 16, 2024

Hey, could one of you test this PR: #2758 ?

@Chartman123
Copy link
Contributor

Hey, could one of you test this PR: #2758 ?

@artonge I've patched the files and ran a ./occ groupfolders:expire. No errors 👍🏻

@github-project-automation github-project-automation bot moved this from 📄 To do (~10 entries) to ☑️ Done in 📁 Files team Jan 17, 2024
@solracsf solracsf unpinned this issue Jan 17, 2024
@heisian
Copy link

heisian commented Jan 19, 2024

very nice! thank you!!

@serg-34
Copy link

serg-34 commented Jan 30, 2024

Hey, could one of you test this PR: #2758 ?

@artonge I've patched the files and ran a ./occ groupfolders:expire. No errors 👍🏻

tell us in more detail how you applied the patch, please

@pReya
Copy link

pReya commented Jan 30, 2024

Hey, could one of you test this PR: #2758 ?

@artonge I've patched the files and ran a ./occ groupfolders:expire. No errors 👍🏻

tell us in more detail how you applied the patch, please

No need to apply the fix manually anymore. Just update to the latest version of the App.

@Chartman123
Copy link
Contributor

There should already be releases including this patch. Other than that it's just basic usage of the patch command in linux or manually doing the changes made in the PR to the coresponding files.

@serg-34
Copy link

serg-34 commented Jan 30, 2024

Hey, could one of you test this PR: #2758 ?

@artonge I've patched the files and ran a ./occ groupfolders:expire. No errors 👍🏻

tell us in more detail how you applied the patch, please

No need to apply the fix manually anymore. Just update to the latest version of the App.

I have the latest version, the patch does not need to be executed. just run the command "./occ groupfolders:expire" ?

@Chartman123
Copy link
Contributor

The expiry should automatically run within the planned tasks executed by cron/webcron/ajax

@alphasixtyfive
Copy link

Unfortunately it looks like there is still a similar error but with Deleted files:

[webdav] Error: An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4-RL71-884 WSSC quot.pdf-1710146321' for key 'groups_folder_trash_unique'
	DELETE /remote.php/dav/files/XXXX/Purchasing/Requisitions/71%20mv%XXXX/Quotations/RL71-884%20WSSC%20quot.pdf
	from XXX by XXX at 11 Mar 2024, 08:38:41

@artonge
Copy link
Contributor

artonge commented Mar 13, 2024

Unfortunately it looks like there is still a similar error but with Deleted files:

This looks like a different issue, can you open a new one?

@alphasixtyfive
Copy link

Unfortunately it looks like there is still a similar error but with Deleted files:

This looks like a different issue, can you open a new one?

This is basically the old issue I've reported earlier #2466.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Issues that are ready for development bug feature: versions Items related to file versioning
Projects
Archived in project