Closed enoch85 closed 10 months ago
With Nextcloud 26.0.0.11, I encounter a different error/stacktrace on occ versions:expire -vvv
, I think it's related to this issue.
An unhandled exception has been thrown:
TypeError: OCP\AppFramework\Db\QBMapper::delete(): Argument #1 ($entity) must be of type OCP\AppFramework\Db\Entity, null given, called in /var/www/html/apps/files_versions/lib/Storage.php on line 615 and defined in /var/www/html/lib/public/AppFramework/Db/QBMapper.php:96
Stack trace:
#0 /var/www/html/apps/files_versions/lib/Storage.php(615): OCP\AppFramework\Db\QBMapper->delete(NULL)
#1 /var/www/html/apps/files_versions/lib/Command/ExpireVersions.php(110): OCA\Files_Versions\Storage::expireOlderThanMaxForUser('daniel')
#2 /var/www/html/apps/files_versions/lib/Command/ExpireVersions.php(97): OCA\Files_Versions\Command\ExpireVersions->expireVersionsForUser(Object(OC\User\User))
#3 /var/www/html/lib/private/User/Manager.php(639): OCA\Files_Versions\Command\ExpireVersions->OCA\Files_Versions\Command\{closure}(Object(OC\User\User))
#4 /var/www/html/apps/files_versions/lib/Command/ExpireVersions.php(98): OC\User\Manager->callForSeenUsers(Object(Closure))
#5 /var/www/html/3rdparty/symfony/console/Command/Command.php(255): OCA\Files_Versions\Command\ExpireVersions->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /var/www/html/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /var/www/html/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files_Versions\Command\ExpireVersions), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /var/www/html/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /var/www/html/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/html/console.php(100): OC\Console\Application->run()
#11 /var/www/html/occ(11): require_once('/var/www/html/c...')
#12 {main}
Nextcloud log also contains this line with the same timestamp as the above event:
Undefined array key 750136 at /var/www/html/apps/files_versions/lib/Storage.php#615
And finally, this: (anyone knows how to break long lines?)
{"reqId":"uhtZoPXGKlze4PjKLXiN","level":3,"time":"2023-04-09T08:15:03+00:00","remoteAddr":"","user":"--","app":"core","method":"","url":"--","message":"Error while running background job (class: OCA\\Files_Versions\\BackgroundJob\\ExpireVersions, arguments: )","userAgent":"--","version":"26.0.0.11","exception":{"Exception":"OCP\\Files\\NotFoundException","Message":"/daniel/files/SofortUpload/hub4.txt","Code":0,"Trace":[{"file":"/var/www/html/lib/private/Files/Node/Folder.php","line":139,"function":"get","class":"OC\\Files\\Node\\Root","type":"->","args":["/daniel/files/SofortUpload/hub4.txt"]},{"file":"/var/www/html/apps/files_versions/lib/Storage.php","line":595,"function":"get","class":"OC\\Files\\Node\\Folder","type":"->","args":["/SofortUpload/hub4.txt"]},{"function":"OCA\\Files_Versions\\{closure}","class":"OCA\\Files_Versions\\Storage","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/apps/files_versions/lib/Storage.php","line":610,"function":"array_filter","args":[["*** sensitive parameters replaced ***","*** sensitive parameters replaced ***","*** sensitive parameters replaced ***","*** sensitive parameters replaced ***","*** sensitive parameters replaced ***","And 44 more entries, set log level to debug to see all entries"],["Closure"]]},{"file":"/var/www/html/apps/files_versions/lib/BackgroundJob/ExpireVersions.php","line":69,"function":"expireOlderThanMaxForUser","class":"OCA\\Files_Versions\\Storage","type":"::","args":["daniel"]},{"file":"/var/www/html/lib/private/User/Manager.php","line":639,"function":"OCA\\Files_Versions\\BackgroundJob\\{closure}","class":"OCA\\Files_Versions\\BackgroundJob\\ExpireVersions","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/apps/files_versions/lib/BackgroundJob/ExpireVersions.php","line":70,"function":"callForSeenUsers","class":"OC\\User\\Manager","type":"->","args":[["Closure"]]},{"file":"/var/www/html/lib/public/BackgroundJob/Job.php","line":78,"function":"run","class":"OCA\\Files_Versions\\BackgroundJob\\ExpireVersions","type":"->","args":[null]},{"file":"/var/www/html/lib/public/BackgroundJob/TimedJob.php","line":103,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->","args":[["OC\\BackgroundJob\\JobList"]]},{"file":"/var/www/html/lib/public/BackgroundJob/TimedJob.php","line":93,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->","args":[["OC\\BackgroundJob\\JobList"]]},{"file":"/var/www/html/cron.php","line":152,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->","args":[["OC\\BackgroundJob\\JobList"],["OC\\Log"]]}],"File":"/var/www/html/lib/private/Files/Node/Root.php","Line":209,"message":"Error while running background job (class: OCA\\Files_Versions\\BackgroundJob\\ExpireVersions, arguments: )","exception":{},"CustomMessage":"Error while running background job (class: OCA\\Files_Versions\\BackgroundJob\\ExpireVersions, arguments: )"}}
The file in question, hub4.txt
, and none of its versions are present on any of NCs filesystems anymore. occ files:cleanup
and occ files:scan --all
don't stop Nextcloud from periodically trying to remove its version and so the mentioned errors are thrown.
I can reproduce the issue on file upload
{
"reqId": "CTudhUurLxOS27C3TxUV",
"level": 3,
"time": "2023-04-29T06:57:24+00:00",
"remoteAddr": "xxx.xxx.xxx.xxx",
"user": "xxxxxxxxxxx",
"app": "no app in context",
"method": "PUT",
"url": "/remote.php/dav/files/xxxxxxxxxx/InstantUpload/2023/04/20230409_174200.jpg",
"message": "Did expect one result but found none when executing: query \"SELECT * FROM `*PREFIX*files_versions` WHERE (`file_id` = :dcValue1) AND (`timestamp` = :dcValue2)\"; ",
"userAgent": "Mozilla/5.0 (Linux) mirall/3.8.1git (Nextcloud, arch-6.2.12-arch1-1 ClientArchitecture: x86_64 OsArchitecture: x86_64)",
"version": "26.0.1.1",
"exception": {
"Exception": "OCP\\AppFramework\\Db\\DoesNotExistException",
"Message": "Did expect one result but found none when executing: query \"SELECT * FROM `*PREFIX*files_versions` WHERE (`file_id` = :dcValue1) AND (`timestamp` = :dcValue2)\"; ",
"Code": 0,
"Trace": [
{
"file": "/var/www/html/lib/public/AppFramework/Db/QBMapper.php",
"line": 361,
"function": "findOneQuery",
"class": "OCP\\AppFramework\\Db\\QBMapper",
"type": "->",
"args": [
[
"OC\\DB\\QueryBuilder\\QueryBuilder"
]
]
},
{
"file": "/var/www/html/apps/files_versions/lib/Db/VersionsMapper.php",
"line": 78,
"function": "findEntity",
"class": "OCP\\AppFramework\\Db\\QBMapper",
"type": "->",
"args": [
[
"OC\\DB\\QueryBuilder\\QueryBuilder"
]
]
},
{
"file": "/var/www/html/apps/files_versions/lib/Listener/FileEventsListener.php",
"line": 242,
"function": "findVersionForFileId",
"class": "OCA\\Files_Versions\\Db\\VersionsMapper",
"type": "->",
"args": [
180544,
1681139688
]
},
{
"file": "/var/www/html/apps/files_versions/lib/Listener/FileEventsListener.php",
"line": 106,
"function": "post_write_hook",
"class": "OCA\\Files_Versions\\Listener\\FileEventsListener",
"type": "->",
"args": [
[
"OC\\Files\\Node\\File"
]
]
},
{
"file": "/var/www/html/lib/private/EventDispatcher/ServiceEventListener.php",
"line": 86,
"function": "handle",
"class": "OCA\\Files_Versions\\Listener\\FileEventsListener",
"type": "->",
"args": [
[
"OCP\\Files\\Events\\Node\\NodeWrittenEvent"
]
]
},
{
"file": "/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
"line": 251,
"function": "__invoke",
"class": "OC\\EventDispatcher\\ServiceEventListener",
"type": "->",
"args": [
[
"OCP\\Files\\Events\\Node\\NodeWrittenEvent"
],
"OCP\\Files\\Events\\Node\\NodeWrittenEvent",
[
"Symfony\\Component\\EventDispatcher\\EventDispatcher"
]
]
},
{
"file": "/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
"line": 73,
"function": "callListeners",
"class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
"type": "->",
"args": [
[
[
"Closure"
],
[
"Closure"
],
[
"Closure"
]
],
"OCP\\Files\\Events\\Node\\NodeWrittenEvent",
[
"OCP\\Files\\Events\\Node\\NodeWrittenEvent"
]
]
},
{
"file": "/var/www/html/lib/private/EventDispatcher/EventDispatcher.php",
"line": 87,
"function": "dispatch",
"class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
"type": "->",
"args": [
[
"OCP\\Files\\Events\\Node\\NodeWrittenEvent"
],
"OCP\\Files\\Events\\Node\\NodeWrittenEvent"
]
},
{
"file": "/var/www/html/lib/private/EventDispatcher/EventDispatcher.php",
"line": 99,
"function": "dispatch",
"class": "OC\\EventDispatcher\\EventDispatcher",
"type": "->",
"args": [
"OCP\\Files\\Events\\Node\\NodeWrittenEvent",
[
"OCP\\Files\\Events\\Node\\NodeWrittenEvent"
]
]
},
{
"file": "/var/www/html/lib/private/Files/Node/HookConnector.php",
"line": 118,
"function": "dispatchTyped",
"class": "OC\\EventDispatcher\\EventDispatcher",
"type": "->",
"args": [
[
"OCP\\Files\\Events\\Node\\NodeWrittenEvent"
]
]
},
{
"file": "/var/www/html/lib/private/legacy/OC_Hook.php",
"line": 105,
"function": "postWrite",
"class": "OC\\Files\\Node\\HookConnector",
"type": "->",
"args": [
[
"/InstantUpload/2023/04/20230409_174200.jpg"
]
]
},
{
"file": "/var/www/html/apps/dav/lib/Connector/Sabre/File.php",
"line": 471,
"function": "emit",
"class": "OC_Hook",
"type": "::",
"args": [
"OC_Filesystem",
"post_write",
[
"/InstantUpload/2023/04/20230409_174200.jpg"
]
]
},
{
"file": "/var/www/html/apps/dav/lib/Connector/Sabre/File.php",
"line": 398,
"function": "emitPostHooks",
"class": "OCA\\DAV\\Connector\\Sabre\\File",
"type": "->",
"args": [
true
]
},
{
"file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
"line": 1137,
"function": "put",
"class": "OCA\\DAV\\Connector\\Sabre\\File",
"type": "->",
"args": [
"*** sensitive parameters replaced ***"
]
},
{
"file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
"line": 492,
"function": "updateFile",
"class": "Sabre\\DAV\\Server",
"type": "->",
"args": [
"*** sensitive parameters replaced ***"
]
},
{
"file": "/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
"line": 89,
"function": "httpPut",
"class": "Sabre\\DAV\\CorePlugin",
"type": "->",
"args": [
[
"Sabre\\HTTP\\Request"
],
[
"Sabre\\HTTP\\Response"
]
]
},
{
"file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
"line": 472,
"function": "emit",
"class": "Sabre\\DAV\\Server",
"type": "->",
"args": [
"method:PUT",
[
[
"Sabre\\HTTP\\Request"
],
[
"Sabre\\HTTP\\Response"
]
]
]
},
{
"file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
"line": 253,
"function": "invokeMethod",
"class": "Sabre\\DAV\\Server",
"type": "->",
"args": [
[
"Sabre\\HTTP\\Request"
],
[
"Sabre\\HTTP\\Response"
]
]
},
{
"file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
"line": 321,
"function": "start",
"class": "Sabre\\DAV\\Server",
"type": "->",
"args": []
},
{
"file": "/var/www/html/apps/dav/lib/Server.php",
"line": 366,
"function": "exec",
"class": "Sabre\\DAV\\Server",
"type": "->",
"args": []
},
{
"file": "/var/www/html/apps/dav/appinfo/v2/remote.php",
"line": 35,
"function": "exec",
"class": "OCA\\DAV\\Server",
"type": "->",
"args": []
},
{
"file": "/var/www/html/remote.php",
"line": 172,
"args": [
"/var/www/html/apps/dav/appinfo/v2/remote.php"
],
"function": "require_once"
}
],
"File": "/var/www/html/lib/public/AppFramework/Db/QBMapper.php",
"Line": 284,
"CustomMessage": "--"
}
}
Cc @artonge
I'm seeing it by cron-Job run
TypeError: OCP\AppFramework\Db\QBMapper::delete(): Argument #1 ($entity) must be of type OCP\AppFramework\Db\Entity, null given, called in /srv/nc/apps/files_versions/lib/Storage.php on line 615 and defined in /srv/nc/lib/public/AppFramework/Db/QBMapper.php:96
Stack trace:
#0 /srv/nc/apps/files_versions/lib/Storage.php(615): OCP\AppFramework\Db\QBMapper->delete()
#1 /srv/nc/apps/files_versions/lib/BackgroundJob/ExpireVersions.php(69): OCA\Files_Versions\Storage::expireOlderThanMaxForUser()
#2 /srv/nc/lib/private/User/Manager.php(639): OCA\Files_Versions\BackgroundJob\ExpireVersions->OCA\Files_Versions\BackgroundJob\{closure}()
#3 /srv/nc/apps/files_versions/lib/BackgroundJob/ExpireVersions.php(70): OC\User\Manager->callForSeenUsers()
#4 /srv/nc/lib/public/BackgroundJob/Job.php(78): OCA\Files_Versions\BackgroundJob\ExpireVersions->run()
#5 /srv/nc/lib/public/BackgroundJob/TimedJob.php(103): OCP\BackgroundJob\Job->start()
#6 /srv/nc/lib/public/BackgroundJob/TimedJob.php(93): OCP\BackgroundJob\TimedJob->start()
#7 /srv/nc/cron.php(152): OCP\BackgroundJob\TimedJob->execute()
#8 {main}
Running Nextcloud 26.0.1.1 on PostgreSQL with PHP 8.1
Closing, as I was not able to reproduce. Feel free to reopen if the issue is still occurring.
If you reopen, please include some reproduction steps to get into a state where occ versions:expire
fails.
⚠️ This issue respects the following points: ⚠️
Bug description
It was supposed to be fixed with this PR but it's still happening on a newly updated NC 26 instance.
Cron doesn't behave as it should.
cc @artonge
Steps to reproduce
occ versions:expire -vvv
Expected behavior
Everything should work.
Installation method
Community Manual installation with Archive
Nextcloud Server version
26
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.1
Web server
Apache (supported)
Database engine version
PostgreSQL
Is this bug present after an update or on a fresh install?
Updated to a major version (ex. 22.2.3 to 23.0.1)
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Additional info
When running
occ versions:expire -vvv