Fix for previews not being generated sometimes#41067
Merged
blizzz merged 1 commit intonextcloud:masterfrom Jan 18, 2024
Merged
Conversation
Signed-off-by: Akhil <akhil@e.email>
CarlSchwan
reviewed
Oct 24, 2023
tcitworld
approved these changes
Oct 25, 2023
Merged
come-nc
approved these changes
Nov 6, 2023
Contributor
Not really, here it’s expected for the node to have no id since it’s new, I think. In the cases I looked into it was paths outside the user directory which ended up trigerring events on null paths. |
artonge
approved these changes
Nov 6, 2023
Contributor
|
@blizzz backport? 🤔 |
Member
|
I understand it was first discovered on 25, so since then everything is affected. |
Member
|
/skjnldsv-backport to stable28 |
Member
|
/skjnldsv-backport to stable27 |
Member
|
/skjnldsv-backport to stable26 |
Contributor
|
/backport to stable28 |
Contributor
|
Hm, does backporting not work if it’s from a fork? |
Contributor
cc @skjnldsv |
This was referenced Jan 22, 2024
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
A lot of unnecessary
rmdircalls are done on the preview directoryAfter investigating, here are the findings to justify the fix:
server/lib/private/Files/FileInfo.php
Line 164 in 834c9a2
intornullnullreturn by this method call over here makes sure that an empty string is passed to$this->appData->getFolder()appdata_*****/previewin our caseOn our instance we did find logs that a delete is attempted on the entire preview folder as per [Bug]: Preview for some photos not generated #36463 (comment)
Further, by logging I could confirm that
$node->getId()is indeed null in one case leading to consistent triggering of thisrmdirOne case is the upload of a partial file (
.partextension)isPartialFile.partextension succesfully triggers anrmdirof the entire preview directoryStack trace of the bug
{ "reqId": "*****", "level": 3, "time": "2023-10-17T17:50:58+00:00", "remoteAddr": "***.***.***.***", "user": "*****", "app": "PHP", "method": "MOVE", "url": "/remote.php/dav/uploads/*****/*****/*****", "message": "rmdir(/var/www/data/appdata_*****/preview/1): Directory not empty at /var/www/html/lib/private/Files/Storage/Local.php#139", "version": "25.0.8.2", "exception": { "Exception": "Error", "Message": "rmdir(/var/www/data/appdata_*****/preview/1): Directory not empty at /var/www/html/lib/private/Files/Storage/Local.php#139", "Code": 0, "Trace": [ { "function": "onError", "class": "OC\\Log\\ErrorHandler", "type": "::", "args": [ 2, "rmdir(/var/www/data/appdata_*****/preview/1): Directory not empty", "/var/www/html/lib/private/Files/Storage/Local.php", 139 ] }, { "file": "/var/www/html/lib/private/Files/Storage/Local.php", "line": 139, "function": "rmdir", "args": [ "/var/www/data/appdata_*****/preview/1" ] }, { "function": "rmdir", "class": "OC\\Files\\Storage\\Local", "type": "->", "args": [ "appdata_*****/preview" ] }, { "file": "/var/www/html/apps/files_trashbin/lib/Storage.php", "line": 193, "function": "call_user_func", "args": [ [ [ "OC\\Files\\Storage\\LocalRootStorage" ], "rmdir" ], "appdata_*****/preview" ] }, { "file": "/var/www/html/apps/files_trashbin/lib/Storage.php", "line": 125, "function": "doDelete", "class": "OCA\\Files_Trashbin\\Storage", "type": "->", "args": [ "appdata_*****/preview", "rmdir" ] }, { "file": "/var/www/html/lib/private/Files/View.php", "line": 1181, "function": "rmdir", "class": "OCA\\Files_Trashbin\\Storage", "type": "->", "args": [ "appdata_*****/preview" ] }, { "file": "/var/www/html/lib/private/Files/View.php", "line": 349, "function": "basicOperation", "class": "OC\\Files\\View", "type": "->", "args": [ "rmdir", "/appdata_*****/preview", [ "delete" ] ] }, { "file": "/var/www/html/lib/private/Files/Node/Folder.php", "line": 363, "function": "rmdir", "class": "OC\\Files\\View", "type": "->", "args": [ "/appdata_*****/preview" ] }, { "file": "/var/www/html/lib/private/Files/SimpleFS/SimpleFolder.php", "line": 68, "function": "delete", "class": "OC\\Files\\Node\\Folder", "type": "->", "args": [] }, { "file": "/var/www/html/lib/private/Preview/Watcher.php", "line": 65, "function": "delete", "class": "OC\\Files\\SimpleFS\\SimpleFolder", "type": "->", "args": [] }, { "file": "/var/www/html/lib/private/Preview/Watcher.php", "line": 54, "function": "deleteNode", "class": "OC\\Preview\\Watcher", "type": "->", "args": [ "*** sensitive parameters replaced ***" ] }, { "file": "/var/www/html/lib/private/Preview/WatcherConnector.php", "line": 63, "function": "postWrite", "class": "OC\\Preview\\Watcher", "type": "->", "args": [ "*** sensitive parameters replaced ***" ] }, { "function": "OC\\Preview\\{closure}", "class": "OC\\Preview\\WatcherConnector", "type": "->", "args": [ "*** sensitive parameters replaced ***" ] }, { "file": "/var/www/html/lib/private/Hooks/EmitterTrait.php", "line": 106, "function": "call_user_func_array", "args": [ [ "Closure" ], [ "*** sensitive parameters replaced ***" ] ] }, { "file": "/var/www/html/lib/private/Hooks/PublicEmitter.php", "line": 40, "function": "emit", "class": "OC\\Hooks\\BasicEmitter", "type": "->", "args": [ "\\OC\\Files", "postWrite", [ "*** sensitive parameters replaced ***" ] ] }, { "file": "/var/www/html/lib/private/Files/Node/Root.php", "line": 143, "function": "emit", "class": "OC\\Hooks\\PublicEmitter", "type": "->", "args": [ "\\OC\\Files", "postWrite", [ "*** sensitive parameters replaced ***" ] ] }, { "function": "emit", "class": "OC\\Files\\Node\\Root", "type": "->", "args": [ "\\OC\\Files", "postWrite", [ "*** sensitive parameters replaced ***" ] ] }, { "file": "/var/www/html/lib/private/Files/Node/LazyFolder.php", "line": 72, "function": "call_user_func_array", "args": [ [ [ "OC\\Files\\Node\\Root" ], "emit" ], [ "\\OC\\Files", "postWrite", [ "*** sensitive parameters replaced ***" ] ] ] }, { "file": "/var/www/html/lib/private/Files/Node/LazyFolder.php", "line": 100, "function": "__call", "class": "OC\\Files\\Node\\LazyFolder", "type": "->", "args": [ "emit", [ "\\OC\\Files", "postWrite", [ "*** sensitive parameters replaced ***" ] ] ] }, { "file": "/var/www/html/lib/private/Files/Node/HookConnector.php", "line": 117, "function": "emit", "class": "OC\\Files\\Node\\LazyFolder", "type": "->", "args": [ "\\OC\\Files", "postWrite", [ "*** sensitive parameters replaced ***" ] ] }, { "file": "/var/www/html/lib/private/legacy/OC_Hook.php", "line": 106, "function": "postWrite", "class": "OC\\Files\\Node\\HookConnector", "type": "->", "args": [ [ "/****/*****/*****/*****.part" ] ] }, { "file": "/var/www/html/apps/dav/lib/Connector/Sabre/File.php", "line": 473, "function": "emit", "class": "OC_Hook", "type": "::", "args": [ "OC_Filesystem", "post_write", [ "/****/*****/*****/*****.part" ] ] }, { "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/apps/dav/lib/Connector/Sabre/Directory.php", "line": 151, "function": "put", "class": "OCA\\DAV\\Connector\\Sabre\\File", "type": "->", "args": [ null ] }, { "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Tree.php", "line": 307, "function": "createFile", "class": "OCA\\DAV\\Connector\\Sabre\\Directory", "type": "->", "args": [ "*****", null ] }, { "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Tree.php", "line": 133, "function": "copyNode", "class": "Sabre\\DAV\\Tree", "type": "->", "args": [ [ "OCA\\DAV\\Upload\\FutureFile" ], [ "OCA\\DAV\\Connector\\Sabre\\Directory" ], "*****" ] }, { "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Tree.php", "line": 163, "function": "copy", "class": "Sabre\\DAV\\Tree", "type": "->", "args": [ "uploads/*****/*****/*****", "files/*****/****/*****/*****/*****.part" ] }, { "file": "/var/www/html/apps/dav/lib/Upload/ChunkingPlugin.php", "line": 94, "function": "move", "class": "Sabre\\DAV\\Tree", "type": "->", "args": [ "uploads/*****/*****/*****", "files/*****/****/*****/*****/*****.part" ] }, { "file": "/var/www/html/apps/dav/lib/Upload/ChunkingPlugin.php", "line": 76, "function": "performMove", "class": "OCA\\DAV\\Upload\\ChunkingPlugin", "type": "->", "args": [ "uploads/*****/*****/*****", "files/*****/****/*****/*****/*****.part" ] }, { "file": "/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php", "line": 89, "function": "beforeMove", "class": "OCA\\DAV\\Upload\\ChunkingPlugin", "type": "->", "args": [ "uploads/*****/*****/*****", "files/*****/****/*****/*****/*****.part" ] }, { "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php", "line": 603, "function": "emit", "class": "Sabre\\DAV\\Server", "type": "->", "args": [ "beforeMove", [ "uploads/*****/*****/*****", "files/*****/****/*****/*****/*****.part" ] ] }, { "file": "/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php", "line": 89, "function": "httpMove", "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:MOVE", [ [ "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": 360, "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/private/Log/ErrorHandler.php", "Line": 92, "CustomMessage": "--" } }Checklist