Hi everyone! Newbie poster here, so please correct me if my post is not correctly formulated
It was previously reported (https://help.nextcloud.com/t/versions-folder-of-groupfolders-isnt-cleared-automatically/175394 ) that versioning was not working on groupfolders files, in some cases causing the consumption of rather a lot of storage space. This problem appears to have been addressed in app release 15.3.2. However, now I am experiencing an hourly error in my logs:
OC\DB\Exceptions\DbalException: An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '79667-1699379642' for key 'gf_versions_uniq_index'
Attempting to run the versions expire by command line also throws errors:
/usr/bin/php occ groupfolders:expire
.
.
.
In DbalException.php line 71:
An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '79667-1699379642' for key 'gf_versions_uniq_index'
In ExceptionConverter.php line 64:
An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '79667-1699379642' for key 'gf_versions_uniq_index'
In Exception.php line 30:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '79667-1699379642' for key 'gf_versions_uniq_index'
In Statement.php line 101:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '79667-1699379642' for key 'gf_versions_uniq_index'
This is happening on two different servers I administer. Is anyone else experiencing this problem?
Thanks!
Colin
1 Like
ernolf
December 20, 2023, 8:14am
2
There is already an Issue. Report your observations there. Workarounds will normaly be reported there first:
opened 06:56AM - 20 Dec 23 UTC
closed 05:16PM - 20 Dec 23 UTC
bug
0. Needs triage
<!--
Thanks for reporting issues back to Nextcloud!
Note: This is the **issu… e tracker of Nextcloud app Group Folder**, please do NOT use this to get answers to your questions or get help for fixing your installation. This is a place to report bugs to developers, after your server has been debugged. You can find help debugging your system on our home user forums: https://help.nextcloud.com or, if you use Nextcloud in a large organization, ask our engineers on https://portal.nextcloud.com. See also https://nextcloud.com/support for support options.
Nextcloud is an open source project backed by Nextcloud GmbH. Most of our volunteers are home users and thus primarily care about issues that affect home users. Our paid engineers prioritize issues of our customers. If you are neither a home user nor a customer, consider paying somebody to fix your issue, do it yourself or become a customer.
Guidelines for submitting issues:
* Please search the existing issues first, it's likely that your issue was already reported or even fixed.
- Go to https://github.com/nextcloud and type any word in the top search/command bar. You probably see something like "We couldn’t find any repositories matching ..." then click "Issues" in the left navigation.
- You can also filter by appending e. g. "state:open" to the search string.
- More info on search syntax within github: https://help.github.com/articles/searching-issues
* This repository https://github.com/nextcloud/groupfolders/issues is *only* for issues within the Group folders code.
* SECURITY: Report any potential security bug to us via our HackerOne page (https://hackerone.com/nextcloud) following our security policy (https://nextcloud.com/security/) instead of filing an issue in our bug tracker.
* The issues in other components should be reported in their respective repositories: You will find them in our GitHub Organization (https://github.com/nextcloud/)
* You can also use the Issue Template app to prefill most of the required information: https://apps.nextcloud.com/apps/issuetemplate
-->
### How to use GitHub
* Please use the 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to show that you are affected by the same issue.
* Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
* Subscribe to receive notifications on status change and new comments.
### Steps to reproduce
1. Execute cron or occ groupfolders:expire
2.
3.
### Expected behaviour
No error message
### Actual behaviour
Since the last update I'm getting this error when cron is executed or when I try to use "occ groupfolders:expire".
I've checked the db and also deleted all entrys in the version table - after the second run the error returns again.
### Server configuration
**Operating system:**
Ubuntu 22.04 LTS
**Web server:**
apache2
**Database:**
PostgreSql
**PHP version:**
8.2
**Nextcloud version:** (see Nextcloud admin page)
27.1.5
**Group folders version:**
15.3.2
**Updated from an older Nextcloud/ownCloud or fresh install:**
Updated
**Where did you install Nextcloud from:**
ZIP-file
**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
### Client configuration
**Browser:**
Chrome
**Operating system:**
Windows
### Logs
#### Nextcloud log (data/nextcloud.log)
<details>
<summary>Nextcloud log</summary>
```
[core] Error: OC\DB\Exceptions\DbalException: An exception occurred while executing a query: SQLSTATE[23505]: Unique violation: 7 FEHLER: doppelter Schlüsselwert verletzt Unique-Constraint »gf_versions_uniq_index«
DETAIL: Schlüssel »(file_id, "timestamp")=(825114, 1601458660)« existiert bereits. at <<closure>>
0. /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php line 328
OC\DB\Exceptions\DbalException::wrap()
1. /var/www/nextcloud/lib/public/AppFramework/Db/QBMapper.php line 137
OC\DB\QueryBuilder\QueryBuilder->executeStatement()
2. /var/www/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php line 88
OCP\AppFramework\Db\QBMapper->insert()
3. /var/www/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php line 72
OCA\GroupFolders\Versions\VersionsBackend->getVersionsForFile()
4. /var/www/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php line 59
OCA\GroupFolders\Versions\GroupVersionsExpireManager->expireFolder()
5. /var/www/nextcloud/apps/groupfolders/lib/BackgroundJob/ExpireGroupVersions.php line 43
OCA\GroupFolders\Versions\GroupVersionsExpireManager->expireAll()
6. /var/www/nextcloud/lib/public/BackgroundJob/Job.php line 81
OCA\GroupFolders\BackgroundJob\ExpireGroupVersions->run()
7. /var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php line 103
OCP\BackgroundJob\Job->start()
8. /var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php line 93
OCP\BackgroundJob\TimedJob->start()
9. /var/www/nextcloud/cron.php line 152
OCP\BackgroundJob\TimedJob->execute()
Caused by:
Doctrine\DBAL\Exception\UniqueConstraintViolationException: An exception occurred while executing a query: SQLSTATE[23505]: Unique violation: 7 FEHLER: doppelter Schlüsselwert verletzt Unique-Constraint »gf_versions_uniq_index«
DETAIL: Schlüssel »(file_id, "timestamp")=(825114, 1601458660)« existiert bereits. at <<closure>>
0. /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php line 1814
Doctrine\DBAL\Driver\API\PostgreSQL\ExceptionConverter->convert()
1. /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php line 1749
Doctrine\DBAL\Connection->handleDriverException()
2. /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php line 1163
Doctrine\DBAL\Connection->convertExceptionDuringQuery()
3. /var/www/nextcloud/lib/private/DB/Connection.php line 295
Doctrine\DBAL\Connection->executeStatement()
4. /var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php line 354
OC\DB\Connection->executeStatement()
5. /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php line 280
Doctrine\DBAL\Query\QueryBuilder->execute()
6. /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php line 326
OC\DB\QueryBuilder\QueryBuilder->execute()
7. /var/www/nextcloud/lib/public/AppFramework/Db/QBMapper.php line 137
OC\DB\QueryBuilder\QueryBuilder->executeStatement()
8. /var/www/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php line 88
OCP\AppFramework\Db\QBMapper->insert()
9. /var/www/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php line 72
OCA\GroupFolders\Versions\VersionsBackend->getVersionsForFile()
10. /var/www/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php line 59
OCA\GroupFolders\Versions\GroupVersionsExpireManager->expireFolder()
11. /var/www/nextcloud/apps/groupfolders/lib/BackgroundJob/ExpireGroupVersions.php line 43
OCA\GroupFolders\Versions\GroupVersionsExpireManager->expireAll()
12. /var/www/nextcloud/lib/public/BackgroundJob/Job.php line 81
OCA\GroupFolders\BackgroundJob\ExpireGroupVersions->run()
13. /var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php line 103
OCP\BackgroundJob\Job->start()
14. /var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php line 93
OCP\BackgroundJob\TimedJob->start()
15. /var/www/nextcloud/cron.php line 152
OCP\BackgroundJob\TimedJob->execute()
Caused by:
Doctrine\DBAL\Driver\PDO\Exception: SQLSTATE[23505]: Unique violation: 7 FEHLER: doppelter Schlüsselwert verletzt Unique-Constraint »gf_versions_uniq_index«
DETAIL: Schlüssel »(file_id, "timestamp")=(825114, 1601458660)« existiert bereits. at <<closure>>
0. /var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php line 103
Doctrine\DBAL\Driver\PDO\Exception::new()
1. /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php line 1153
Doctrine\DBAL\Driver\PDO\Statement->execute()
2. /var/www/nextcloud/lib/private/DB/Connection.php line 295
Doctrine\DBAL\Connection->executeStatement()
3. /var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php line 354
OC\DB\Connection->executeStatement()
4. /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php line 280
Doctrine\DBAL\Query\QueryBuilder->execute()
5. /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php line 326
OC\DB\QueryBuilder\QueryBuilder->execute()
6. /var/www/nextcloud/lib/public/AppFramework/Db/QBMapper.php line 137
OC\DB\QueryBuilder\QueryBuilder->executeStatement()
7. /var/www/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php line 88
OCP\AppFramework\Db\QBMapper->insert()
8. /var/www/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php line 72
OCA\GroupFolders\Versions\VersionsBackend->getVersionsForFile()
9. /var/www/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php line 59
OCA\GroupFolders\Versions\GroupVersionsExpireManager->expireFolder()
10. /var/www/nextcloud/apps/groupfolders/lib/BackgroundJob/ExpireGroupVersions.php line 43
OCA\GroupFolders\Versions\GroupVersionsExpireManager->expireAll()
11. /var/www/nextcloud/lib/public/BackgroundJob/Job.php line 81
OCA\GroupFolders\BackgroundJob\ExpireGroupVersions->run()
12. /var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php line 103
OCP\BackgroundJob\Job->start()
13. /var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php line 93
OCP\BackgroundJob\TimedJob->start()
14. /var/www/nextcloud/cron.php line 152
OCP\BackgroundJob\TimedJob->execute()
Caused by:
PDOException: SQLSTATE[23505]: Unique violation: 7 FEHLER: doppelter Schlüsselwert verletzt Unique-Constraint »gf_versions_uniq_index«
DETAIL: Schlüssel »(file_id, "timestamp")=(825114, 1601458660)« existiert bereits. at <<closure>>
0. /var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php line 101
PDOStatement->execute()
1. /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php line 1153
Doctrine\DBAL\Driver\PDO\Statement->execute()
2. /var/www/nextcloud/lib/private/DB/Connection.php line 295
Doctrine\DBAL\Connection->executeStatement()
3. /var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php line 354
OC\DB\Connection->executeStatement()
4. /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php line 280
Doctrine\DBAL\Query\QueryBuilder->execute()
5. /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php line 326
OC\DB\QueryBuilder\QueryBuilder->execute()
6. /var/www/nextcloud/lib/public/AppFramework/Db/QBMapper.php line 137
OC\DB\QueryBuilder\QueryBuilder->executeStatement()
7. /var/www/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php line 88
OCP\AppFramework\Db\QBMapper->insert()
8. /var/www/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php line 72
OCA\GroupFolders\Versions\VersionsBackend->getVersionsForFile()
9. /var/www/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php line 59
OCA\GroupFolders\Versions\GroupVersionsExpireManager->expireFolder()
10. /var/www/nextcloud/apps/groupfolders/lib/BackgroundJob/ExpireGroupVersions.php line 43
OCA\GroupFolders\Versions\GroupVersionsExpireManager->expireAll()
11. /var/www/nextcloud/lib/public/BackgroundJob/Job.php line 81
OCA\GroupFolders\BackgroundJob\ExpireGroupVersions->run()
12. /var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php line 103
OCP\BackgroundJob\Job->start()
13. /var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php line 93
OCP\BackgroundJob\TimedJob->start()
14. /var/www/nextcloud/cron.php line 152
OCP\BackgroundJob\TimedJob->execute()
at 2023-12-20T07:10:03+01:00
```
</details>
Much luck,
ernolf
1 Like
This is also already discussed here:
opened 12:50PM - 17 Sep 23 UTC
bug
1. to develop
feature: versions
### Steps to reproduce
1. Error appears in the log with cron jobs, or when usin… g `docker run (...) occ groupfolders:expire -v`
### Expected behaviour
I don't know, it should expire all versions in folders ?
### 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](https://github.com/nextcloud/groupfolders/blob/c5d35231ec12d8a217a50d7728681011184bb1bd/lib/Versions/GroupVersionsExpireManager.php#L72) 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 ?
1 Like
unfortunately, nobody seems to be working on the issue and there is no known workaround. It has been around since September and it breaks absolutely vital functionality, yet it is given no attention. Since “groupfolders” is one of Nextcloud’s “featured apps”, this is kind of annoying and unexpected (although groupfolders has been suffering from poor maintenance in the past, I have to say).
1 Like
You posted at GitHub already.
Why crossposting here as well?
I will marked this topic as solved and will close it.
We should stay with the mentioned GitHub issue and keep discussion there.
This topic was automatically opened after 19 hours.