File is not removed by background job (no user backend)
Rello opened this issue · comments
Steps to reproduce
- create an invected file in files
- wait for the next background job
- see the logs
Expected behaviour
- Activity entry that the file was deleted
- The file is actually removed
Actual behaviour
- Activity entry that the file was deleted
- The file is not removed
- error recorded in the logfile
Server configuration
Operating system:
Web server:
Database:
PHP version:
Nextcloud version: (see Nextcloud admin page)
Where did you install Nextcloud from:
List of activated apps:
Antivirus 5.2.2
Nextcloud configuration:
27.1.1
Client configuration
Browser:
Operating system:
Logs
Nextcloud log (data/owncloud.log)
{"reqId":"8Wpusbh03HOjgudHD2JQ","level":3,"time":"2023-10-20T10:53:02+02:00","remoteAddr":"","user":"--","app":"files_antivirus","method":"","url":"--","message":"Infected file deleted (during background scan) Type=0; Resolution=2; Threat=Win.Test.EICAR_HDB-1; File: 808 Account: bced5c02-f2da-103d-8627-579fb31c2125 Path: /bced5c02-f2da-103d-8627-579fb31c2125/files/Eicar.com.txt","userAgent":"--","version":"27.1.1.0","data":{"app":"files_antivirus"}}
{"reqId":"8Wpusbh03HOjgudHD2JQ","level":3,"time":"2023-10-20T10:53:02+02:00","remoteAddr":"","user":"--","app":"files","method":"","url":"--","message":"Backends provided no user object for ","userAgent":"--","version":"27.1.1.0","exception":{"Exception":"OC\\User\\NoUserException","Message":"Backends provided no user object","Code":0,"Trace":[{"function":"getUserFolder","class":"OC\\Files\\Node\\Root","type":"->","args":[false]},{"file":"/var/www/html/lib/private/Files/Node/LazyFolder.php","line":74,"function":"call_user_func_array","args":[[["OC\\Files\\Node\\Root"],"getUserFolder"],[false]]},{"file":"/var/www/html/lib/private/Files/Node/LazyRoot.php","line":40,"function":"__call","class":"OC\\Files\\Node\\LazyFolder","type":"->","args":["getUserFolder",[false]]},{"file":"/var/www/html/apps/files_versions/lib/Listener/FileEventsListener.php","line":359,"function":"getUserFolder","class":"OC\\Files\\Node\\LazyRoot","type":"->","args":[false]},{"file":"/var/www/html/apps/files_versions/lib/Listener/FileEventsListener.php","line":295,"function":"getPathForNode","class":"OCA\\Files_Versions\\Listener\\FileEventsListener","type":"->","args":[["OC\\Files\\Node\\File"]]},{"file":"/var/www/html/apps/files_versions/lib/Listener/FileEventsListener.php","line":116,"function":"pre_remove_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\\BeforeNodeDeletedEvent"]]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":251,"function":"__invoke","class":"OC\\EventDispatcher\\ServiceEventListener","type":"->","args":[["OCP\\Files\\Events\\Node\\BeforeNodeDeletedEvent"],"OCP\\Files\\Events\\Node\\BeforeNodeDeletedEvent",["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\\BeforeNodeDeletedEvent",["OCP\\Files\\Events\\Node\\BeforeNodeDeletedEvent"]]},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":94,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":[["OCP\\Files\\Events\\Node\\BeforeNodeDeletedEvent"],"OCP\\Files\\Events\\Node\\BeforeNodeDeletedEvent"]},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":106,"function":"dispatch","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":["OCP\\Files\\Events\\Node\\BeforeNodeDeletedEvent",["OCP\\Files\\Events\\Node\\BeforeNodeDeletedEvent"]]},{"file":"/var/www/html/lib/private/Files/Node/HookConnector.php","line":149,"function":"dispatchTyped","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":[["OCP\\Files\\Events\\Node\\BeforeNodeDeletedEvent"]]},{"file":"/var/www/html/lib/private/legacy/OC_Hook.php","line":105,"function":"delete","class":"OC\\Files\\Node\\HookConnector","type":"->","args":[[true,"/Eicar.com.txt"]]},{"file":"/var/www/html/lib/private/Files/View.php","line":1270,"function":"emit","class":"OC_Hook","type":"::","args":["OC_Filesystem","delete",[true,"/Eicar.com.txt"]]},{"file":"/var/www/html/lib/private/Files/View.php","line":1144,"function":"runHooks","class":"OC\\Files\\View","type":"->","args":[["delete"],"/Eicar.com.txt"]},{"file":"/var/www/html/lib/private/Files/View.php","line":702,"function":"basicOperation","class":"OC\\Files\\View","type":"->","args":["unlink","/bced5c02-f2da-103d-8627-579fb31c2125/files/Eicar.com.txt",["delete"]]},{"file":"/var/www/html/lib/private/Files/Node/File.php","line":133,"function":"unlink","class":"OC\\Files\\View","type":"->","args":["/bced5c02-f2da-103d-8627-579fb31c2125/files/Eicar.com.txt"]},{"file":"/var/www/html/custom_apps/files_antivirus/lib/Item.php","line":217,"function":"delete","class":"OC\\Files\\Node\\File","type":"->","args":[]},{"file":"/var/www/html/custom_apps/files_antivirus/lib/Item.php","line":118,"function":"deleteFile","class":"OCA\\Files_Antivirus\\Item","type":"->","args":[]},{"file":"/var/www/html/custom_apps/files_antivirus/lib/Status.php","line":164,"function":"processInfected","class":"OCA\\Files_Antivirus\\Item","type":"->","args":[["OCA\\Files_Antivirus\\Status"]]},{"file":"/var/www/html/custom_apps/files_antivirus/lib/BackgroundJob/BackgroundScanner.php","line":274,"function":"dispatch","class":"OCA\\Files_Antivirus\\Status","type":"->","args":[["OCA\\Files_Antivirus\\Item"]]},{"file":"/var/www/html/custom_apps/files_antivirus/lib/BackgroundJob/BackgroundScanner.php","line":144,"function":"scanOneFile","class":"OCA\\Files_Antivirus\\BackgroundJob\\BackgroundScanner","type":"->","args":[["OC\\Files\\Node\\File"]]},
Can you check if nextcloud/server#41309 resolves the issue for you?
@icewind1991
they deployed the patch.
I can still see an error, but it seems to be another one?
[core] Fehler: Error: Call to a member function getUID() on null at <>
- /var/www/html/lib/private/EventDispatcher/ServiceEventListener.php line 86
OCA\OpenProject\Listener\BeforeNodeInsideOpenProjectGroupfilderChangedListener->handle(["OCP\Files\Ev ... "]) - /var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php line 251
OC\EventDispatcher\ServiceEventListener->__invoke(["OCP\Files\Ev ... "], "OCP\Files\Eve ... t", ["Symfony\Compo ... "]) - /var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php line 73
Symfony\Component\EventDispatcher\EventDispatcher->callListeners([["Closure"],["Closure"],["Closure"]], "OCP\Files\Eve ... t", ["OCP\Files\Ev ... "]) - /var/www/html/lib/private/EventDispatcher/EventDispatcher.php line 94
Symfony\Component\EventDispatcher\EventDispatcher->dispatch(["OCP\Files\Ev ... "], "OCP\Files\Eve ... t") - /var/www/html/lib/private/EventDispatcher/EventDispatcher.php line 106
OC\EventDispatcher\EventDispatcher->dispatch("OCP\Files\Eve ... t", ["OCP\Files\Ev ... "]) - /var/www/html/lib/private/Files/Node/HookConnector.php line 149
OC\EventDispatcher\EventDispatcher->dispatchTyped(["OCP\Files\Ev ... "]) - /var/www/html/lib/private/legacy/OC_Hook.php line 105
OC\Files\Node\HookConnector->delete([true,"/test-icap.txt"]) - /var/www/html/lib/private/Files/View.php line 1270
OC_Hook::emit("OC_Filesystem", "delete", [true,"/test-icap.txt"]) - /var/www/html/lib/private/Files/View.php line 1144
OC\Files\View->runHooks(["delete"], "/test-icap.txt") - /var/www/html/lib/private/Files/View.php line 702
OC\Files\View->basicOperation("unlink", "/23a2cfac-1e3e- ... t", ["delete"]) - /var/www/html/lib/private/Files/Node/File.php line 133
OC\Files\View->unlink("/23a2cfac-1e3e- ... t") - /var/www/html/custom_apps/files_antivirus/lib/Item.php line 217
OC\Files\Node\File->delete() - /var/www/html/custom_apps/files_antivirus/lib/Item.php line 118
OCA\Files_Antivirus\Item->deleteFile() - /var/www/html/custom_apps/files_antivirus/lib/Status.php line 164
OCA\Files_Antivirus\Item->processInfected(["OCA\Files_Antivirus\Status"]) - /var/www/html/custom_apps/files_antivirus/lib/BackgroundJob/BackgroundScanner.php line 283
OCA\Files_Antivirus\Status->dispatch(["OCA\Files_Antivirus\Item"]) - /var/www/html/custom_apps/files_antivirus/lib/BackgroundJob/BackgroundScanner.php line 144
OCA\Files_Antivirus\BackgroundJob\BackgroundScanner->scanOneFile(["OC\Files\Node\File"]) - /var/www/html/custom_apps/files_antivirus/lib/BackgroundJob/BackgroundScanner.php line 97
OCA\Files_Antivirus\BackgroundJob\BackgroundScanner->processFiles(["LimitIterator"]) - /var/www/html/custom_apps/files_antivirus/lib/BackgroundJob/BackgroundScanner.php line 80
OCA\Files_Antivirus\BackgroundJob\BackgroundScanner->scan(100) - /var/www/html/lib/public/BackgroundJob/Job.php line 81
OCA\Files_Antivirus\BackgroundJob\BackgroundScanner->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"])
at 2023-11-24T14:52:01+01:00
{"reqId":"T3RaAL2lgRVcIpYNXIOw","level":3,"time":"2023-11-24T14:52:01+01:00","remoteAddr":"","user":"--","app":"files_antivirus","method":"","url":"--","message":"Infected file deleted (during background scan) Type=0; Resolution=2; Threat=Win.Test.EICAR_HDB-1; File: 146 Account: 23a2cfac-1e3e-103e-88b8-392cb13ec756 Path: /23a2cfac-1e3e-103e-88b8-392cb13ec756/files/test-icap.txt","userAgent":"--","version":"27.1.1.0","data":{"app":"files_antivirus"},"id":"6560ab4153ebd"}
That seems to be an issue with the integration_openproject
app not handling file deletions from background jobs correctly.
Thanks everyone. We will have a look into it ASAP // @julien-nc @individual-it @SagarGi @SwikritiT
If I understand it right, the hook in our app integration_openproject
expects a user which does not exists in this kind of background jobs.