nextcloud / groupfolders

๐Ÿ“๐Ÿ‘ฉโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Admin-configured folders shared by everyone in a group. https://github.com/nextcloud-releases/groupfolders
https://apps.nextcloud.com/apps/groupfolders
279 stars 85 forks source link

Group folder file sharing in Talk breaks Files app: `Call to a member function getCache() on null` #945

Open manu-p opened 4 years ago

manu-p commented 4 years ago

Hi,

Already mentioned here and here: sharing a file stored in a group folder sometimes makes the Files app fail.

After others users, we faced this strange behavior with NC 18.0.4 / MySQL 5.7.30 / Apache 2.4.29 / PHP 7.4.6.

When entering the Files App, a message is displayed to the user saying something like (reverse translated in English) "this folder is not available, consult the logs or contact your administrator". And no folder/file is displayed. Nothing. Just like there's no folders/files anymore (which is not the case).

The system log shows: `Error remote Error: Call to a member function getCache() on null

/var/www/nextcloud/apps/files_sharing/lib/SharedStorage.php - line 382:
OCA\Files_Sharing\SharedStorage->getSourceRootInfo()

/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php - line 393:
OCA\Files_Sharing\SharedStorage->getCache()

/var/www/nextcloud/lib/private/Files/View.php - line 1746:
OC\Files\Storage\Wrapper\Wrapper->getCache()

/var/www/nextcloud/apps/files_sharing/lib/SharedStorage.php - line 128:
OC\Files\View->getPath()

/var/www/nextcloud/apps/files_sharing/lib/SharedStorage.php - line 477:
OCA\Files_Sharing\SharedStorage->init()

<<closure>>
OCA\Files_Sharing\SharedStorage->getSourceStorage()

/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php - line 506:
call_user_func_array()

/var/www/nextcloud/apps/files_sharing/lib/Cache.php - line 94:
OC\Files\Storage\Wrapper\Wrapper->__call()

/var/www/nextcloud/lib/private/Files/Cache/Wrapper/CacheJail.php - line 309:
OCA\Files_Sharing\Cache->getCache()

/var/www/nextcloud/lib/private/Files/View.php - line 1747:
OC\Files\Cache\Wrapper\CacheJail->getPathById()

/var/www/nextcloud/apps/files_sharing/lib/SharedStorage.php - line 128:
OC\Files\View->getPath()

/var/www/nextcloud/apps/files_sharing/lib/SharedStorage.php - line 112:
OCA\Files_Sharing\SharedStorage->init()

/var/www/nextcloud/apps/files_sharing/lib/SharedStorage.php - line 382:
OCA\Files_Sharing\SharedStorage->getSourceRootInfo()

/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php - line 393:
OCA\Files_Sharing\SharedStorage->getCache()

/var/www/nextcloud/lib/private/Files/View.php - line 1478:
OC\Files\Storage\Wrapper\Wrapper->getCache()

/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php - line 265:
OC\Files\View->getDirectoryContent()

/var/www/nextcloud/apps/dav/lib/Connector/Sabre/TagsPlugin.php - line 227:
OCA\DAV\Connector\Sabre\Directory->getChildren()

<<closure>>
OCA\DAV\Connector\Sabre\TagsPlugin->handleGetProperties()

/var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105:
call_user_func_array()

/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 1059:
Sabre\Event\EventEmitter->emit()

/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 981:
Sabre\DAV\Server->getPropertiesByNode()

/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 1666:
Sabre\DAV\Server->getPropertiesIteratorForPath()

/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 355:
Sabre\DAV\Server->generateMultiStatus()

<<closure>>
Sabre\DAV\CorePlugin->httpPropFind()

/var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105:
call_user_func_array()

/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 479:
Sabre\Event\EventEmitter->emit()

/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 254:
Sabre\DAV\Server->invokeMethod()

/var/www/nextcloud/apps/dav/lib/Server.php - line 319:
Sabre\DAV\Server->exec()

/var/www/nextcloud/apps/dav/appinfo/v2/remote.php - line 35:
OCA\DAV\Server->exec()

/var/www/nextcloud/remote.php - line 165:
require_once("/var/www/ne ... p")`

The workaround seems to delete entries in the oc_share table, which worked for us today.

As it is suggested here, I'm now reporting the issue to the groupfolder app.

t-markmann commented 4 years ago

I had this issue in a customer instance with NC 17.0.3. The symtom that the root of files app is not accessible anymore indeed appeared suddenly and I could not figure out the reason. The customer did not have groupfolders installed.

Maybe Related: I think I was able to reproduce the cause for the bug. In my test I had a groupname with german umlauts and an asterisk (*). (this might be relevant or not) This group had access to a groupfolder with a normal name.

I shared a file from that groupfolder with another group with umlauts and an asterisk. Members of the receiving group were able to edit the file, but Collabora did not save it (error message). The file owner then deleted the file. In the talk conversation, there is a correct message: User shared a file that has been deleted. In the files app of the receiving user I now see the old file with a directory icon, wrong last edited and size data.

grafik

This was testet with current Apache, PHP7.3, MySQL and Nextcloud 18.0.6.

In the customer instance there was a jpeg file, that had a directory icon and wrong data. After I found it and deleted the shared, the root directory worked fine again. So I think this is related.

Log entry for my test ` {"reqId":"osk1jybqTMJfujBcg5iO","level":3,"time":"2020-07-11T04:56:22+00:00","remoteAddr":"88.130.57.130","user":"s1","app":"no app in context","method":"GET","url":"/aa-talkbug1/ocs/v2.php/apps/text/workspace?path=%2Ftest3.odt","message":{"Exception":"OCP\\Files\\StorageNotAvailableException","Message":"File with id \"183\" has not been found.","Code":0,"Trace":[{"file":"/mywebroot/aa-talkbug1/lib/private/Files/Storage/Wrapper/Jail.php","line":239,"function":"file_exists","class":"OC\\Files\\Storage\\FailedStorage","type":"->","args":["/Anleitung.md"]},{"file":"/mywebroot/aa-talkbug1/lib/private/Files/Storage/Wrapper/Wrapper.php","line":225,"function":"file_exists","class":"OC\\Files\\Storage\\Wrapper\\Jail","type":"->","args":["Anleitung.md"]},{"file":"/mywebroot/aa-talkbug1/lib/private/Files/View.php","line":1335,"function":"file_exists","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":["Anleitung.md"]},{"file":"/mywebroot/aa-talkbug1/lib/private/Files/View.php","line":1384,"function":"getCacheEntry","class":"OC\\Files\\View","type":"->","args":[{"cache":null,"scanner":null,"watcher":null,"propagator":null,"updater":null,"__class__":"OCA\\Files_Trashbin\\Storage"},"Anleitung.md","/s1/files/test3.odt/Anleitung.md"]},{"file":"/mywebroot/aa-talkbug1/lib/private/Files/Node/Root.php","line":200,"function":"getFileInfo","class":"OC\\Files\\View","type":"->","args":["/s1/files/test3.odt/Anleitung.md"]},{"file":"/mywebroot/aa-talkbug1/lib/private/Files/Node/Folder.php","line":137,"function":"get","class":"OC\\Files\\Node\\Root","type":"->","args":["/s1/files/test3.odt/Anleitung.md"]},{"file":"/mywebroot/aa-talkbug1/lib/private/Files/Node/Folder.php","line":146,"function":"get","class":"OC\\Files\\Node\\Folder","type":"->","args":["Anleitung.md"]},{"file":"/mywebroot/aa-talkbug1/apps/text/lib/Service/WorkspaceService.php","line":28,"function":"nodeExists","class":"OC\\Files\\Node\\Folder","type":"->","args":["Anleitung.md"]},{"file":"/mywebroot/aa-talkbug1/apps/text/lib/Controller/WorkspaceController.php","line":112,"function":"getFile","class":"OCA\\Text\\Service\\WorkspaceService","type":"->","args":[{"__class__":"OC\\Files\\Node\\Folder"}]},{"file":"/mywebroot/aa-talkbug1/lib/private/AppFramework/Http/Dispatcher.php","line":170,"function":"folder","class":"OCA\\Text\\Controller\\WorkspaceController","type":"->","args":["/test3.odt"]},{"file":"/mywebroot/aa-talkbug1/lib/private/AppFramework/Http/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Text\\Controller\\WorkspaceController"},"folder"]},{"file":"/mywebroot/aa-talkbug1/lib/private/AppFramework/App.php","line":125,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Text\\Controller\\WorkspaceController"},"folder"]},{"file":"/mywebroot/aa-talkbug1/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Text\\Controller\\WorkspaceController","folder",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"ocs.text.Workspace.folder"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"_route":"ocs.text.Workspace.folder"}]},{"file":"/mywebroot/aa-talkbug1/lib/private/Route/Router.php","line":299,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"_route":"ocs.text.Workspace.folder"}]},{"file":"/mywebroot/aa-talkbug1/ocs/v1.php","line":82,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/ocsapp/apps/text/workspace"]},{"file":"/mywebroot/aa-talkbug1/ocs/v2.php","line":24,"args":["/mywebroot/aa-talkbug1/ocs/v1.php"],"function":"require_once"}],"File":"/mywebroot/aa-talkbug1/lib/private/Files/Storage/FailedStorage.php","Line":114,"Hint":"Storage is temporarily not available","Previous":{"Exception":"OCP\\Files\\NotFoundException","Message":"File with id \"183\" has not been found.","Code":0,"Trace":[{"file":"/mywebroot/aa-talkbug1/apps/files_sharing/lib/SharedStorage.php","line":128,"function":"getPath","class":"OC\\Files\\View","type":"->","args":[183]},{"file":"/mywebroot/aa-talkbug1/apps/files_sharing/lib/SharedStorage.php","line":112,"function":"init","class":"OCA\\Files_Sharing\\SharedStorage","type":"->","args":[]},{"file":"/mywebroot/aa-talkbug1/apps/files_sharing/lib/SharedStorage.php","line":382,"function":"getSourceRootInfo","class":"OCA\\Files_Sharing\\SharedStorage","type":"->","args":[]},{"file":"/mywebroot/aa-talkbug1/lib/private/Files/Storage/Wrapper/Wrapper.php","line":393,"function":"getCache","class":"OCA\\Files_Sharing\\SharedStorage","type":"->","args":["",{"cache":null,"scanner":null,"watcher":null,"propagator":null,"updater":null,"__class__":"OCA\\Files_Trashbin\\Storage"}]},{"file":"/mywebroot/aa-talkbug1/lib/private/Files/View.php","line":1328,"function":"getCache","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":[""]},{"file":"/mywebroot/aa-talkbug1/lib/private/Files/View.php","line":1384,"function":"getCacheEntry","class":"OC\\Files\\View","type":"->","args":[{"cache":null,"scanner":null,"watcher":null,"propagator":null,"updater":null,"__class__":"OCA\\Files_Trashbin\\Storage"},"","/s1/files/test3.odt"]},{"file":"/mywebroot/aa-talkbug1/lib/private/Files/Node/Root.php","line":200,"function":"getFileInfo","class":"OC\\Files\\View","type":"->","args":["/s1/files/test3.odt"]},{"file":"/mywebroot/aa-talkbug1/lib/private/Files/Node/Folder.php","line":137,"function":"get","class":"OC\\Files\\Node\\Root","type":"->","args":["/s1/files/test3.odt"]},{"file":"/mywebroot/aa-talkbug1/apps/text/lib/Controller/WorkspaceController.php","line":110,"function":"get","class":"OC\\Files\\Node\\Folder","type":"->","args":["/test3.odt"]},{"file":"/mywebroot/aa-talkbug1/lib/private/AppFramework/Http/Dispatcher.php","line":170,"function":"folder","class":"OCA\\Text\\Controller\\WorkspaceController","type":"->","args":["/test3.odt"]},{"file":"/mywebroot/aa-talkbug1/lib/private/AppFramework/Http/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Text\\Controller\\WorkspaceController"},"folder"]},{"file":"/mywebroot/aa-talkbug1/lib/private/AppFramework/App.php","line":125,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Text\\Controller\\WorkspaceController"},"folder"]},{"file":"/mywebroot/aa-talkbug1/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Text\\Controller\\WorkspaceController","folder",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"ocs.text.Workspace.folder"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"_route":"ocs.text.Workspace.folder"}]},{"file":"/mywebroot/aa-talkbug1/lib/private/Route/Router.php","line":299,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"_route":"ocs.text.Workspace.folder"}]},{"file":"/mywebroot/aa-talkbug1/ocs/v1.php","line":82,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/ocsapp/apps/text/workspace"]},{"file":"/mywebroot/aa-talkbug1/ocs/v2.php","line":24,"args":["/mywebroot/aa-talkbug1/ocs/v1.php"],"function":"require_once"}],"File":"/mywebroot/aa-talkbug1/lib/private/Files/View.php","Line":1756},"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0","version":"18.0.6.0"} ` Anleitung.md was another file I deleted. I don't really understand what happens here :-)
Linuxfabrik commented 2 years ago

This is still occurring in Nextcloud version 21.0.5.

Error: Call to a member function getPath() on null in /var/www/html/nextcloud/lib/private/Files/Filesystem.php:901
Stack trace:
#0 /var/www/html/nextcloud/lib/private/Encryption/Update.php(107): OC\Files\Filesystem::getPath()
#1 /var/www/html/nextcloud/lib/private/Encryption/HookManager.php(40): OC\Encryption\Update->postUnshared()
#2 /var/www/html/nextcloud/lib/private/legacy/OC_Hook.php(110): OC\Encryption\HookManager::postUnshared()
#3 /var/www/html/nextcloud/lib/private/Share20/LegacyHooks.php(85): OC_Hook::emit()
#4 /var/www/html/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php(264): OC\Share20\LegacyHooks->postUnshare()
#5 /var/www/html/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php(239): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch()
#6 /var/www/html/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php(73): Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
#7 /var/www/html/nextcloud/lib/private/EventDispatcher/SymfonyAdapter.php(94): Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
#8 /var/www/html/nextcloud/lib/private/Share20/Manager.php(1193): OC\EventDispatcher\SymfonyAdapter->dispatch()
#9 /var/www/html/nextcloud/lib/private/Share20/Manager.php(1500): OC\Share20\Manager->deleteShare()
#10 /var/www/html/nextcloud/lib/private/Share20/Manager.php(1401): OC\Share20\Manager->checkExpireDate()
#11 /var/www/html/nextcloud/apps/files_sharing/lib/ExpireSharesJob.php(98): OC\Share20\Manager->getShareById()
#12 /var/www/html/nextcloud/lib/public/BackgroundJob/Job.php(80): OCA\Files_Sharing\ExpireSharesJob->run()
#13 /var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php(61): OCP\BackgroundJob\Job->execute()
#14 /var/www/html/nextcloud/cron.php(128): OCP\BackgroundJob\TimedJob->execute()
#15 {main}
joshtrichards commented 3 weeks ago

Is anyone actually still experiencing this issue? I can't pinpoint the exact fix, but I also find it hard to believe this is still a thing given how quiet this issue has been for years now.