richdocuments icon indicating copy to clipboard operation
richdocuments copied to clipboard

Not enough storage error on save

Open jugendhacker opened this issue 1 year ago • 8 comments

Describe the bug

When trying to save a file shared to a user from a groupfolder that the user itself has no access to, the file does not get saved and instead an error message is displayed. In the logs of the nextcloud server there is an corresponding error which tells there is not enough storage space, although there is.

To Reproduce Steps to reproduce the behavior:

  1. Create a richdocument in an group folder with user A
  2. Share this document with user B that has no access to the group folder itself
  3. Let user B edit the file and try to save it

Expected behavior Document should be saved, as the user has read/write permissions to the file itself.

Screenshots

error displayed

Client details:

  • OS: Linux
  • Browser: Firefox
  • Version: 130
  • Device: desktop

Server details

Operating system: Debian

Web server: Traefik and apache inside the official Docker image

Database: MariaDB

PHP version: 8.2.23

Nextcloud version: 29.0.6

Version of the richdocuments app 8.4.6

Version of Collabora Online 24.04.7.1

Configuration of the richdocuments app

{
    "apps": {
        "richdocuments": {
            "disable_certificate_verification": "",
            "enabled": "yes",
            "installed_version": "8.4.6",
            "public_wopi_url": "REDACTED",
            "types": "prevent_group_restriction",
            "use_groups": "",
            "wopi_allowlist": "",
            "wopi_url": "REDACTED"
        }
    }
}
Logs

Nextcloud log (data/nextcloud.log)

{"reqId":"4LFcGsbgFOgV62d4ktkd","level":3,"time":"2024-09-12T22:07:07+02:00","remoteAddr":"172.18.0.1","user":"--","app":"richdocuments","method":"POST","url":"/index.php/apps/richdocuments/wopi/files/7778287_occ4xw8zqzs4/contents?access_token=Aqemp9HVoO7QQQwxUxcO04VZ1Gwlsqqo&access_token_ttl=0","message":"Not enough storage","userAgent":"COOLWSD HTTP Agent 24.04.7.1","version":"29.0.6.1","exception":{"Exception":"Exception","Message":"Not enough storage","Code":0,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":232,"function":"putFile","class":"OCA\\Richdocuments\\Controller\\WopiController","type":"->","args":["7778287","Aqemp9HVoO7QQQwxUxcO04VZ1Gwlsqqo"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":138,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Richdocuments\\Controller\\WopiController"],"putFile"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Richdocuments\\Controller\\WopiController"],"putFile"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":331,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Richdocuments\\Controller\\WopiController","putFile",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["7778287_occ4xw8zqzs4","richdocuments.wopi.putfile"]]},{"file":"/var/www/html/lib/base.php","line":1058,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/richdocuments/wopi/files/7778287_occ4xw8zqzs4/contents"]},{"file":"/var/www/html/index.php","line":49,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/custom_apps/richdocuments/lib/Controller/WopiController.php","Line":501,"message":"Not enough storage","exception":[],"CustomMessage":"Not enough storage"},"id":"66e349f2a97e5"}

Browser log

Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log
c) ...

jugendhacker avatar Sep 12 '24 20:09 jugendhacker

I have a very similiar issue that might be realted? - https://github.com/CollaboraOnline/online/issues/9328 After the error about permissions grafik was blamed on groupfolders i decided to migrate to a classic shared folder. While i was doing so, richdocuments started to throw the following error refusing to open any document anywhere in nextcloud: "Kein Festplattenplatz mehr auf dem Server" grafik (not enough diskspace ) wich was fixed by restarting the instance but came back just a couple of minutes later. In the time between the restarts i could test enough to notice richdocuments now als throwing the first error in normal shared folders. In the logs i find a ton of: [richdocuments] Fehler: Uncaught error: OCA\Passwords\Services\EnvironmentService::loadUserFromBearerAuth(): Argument #1 ($userId) must be of type string, null given, called in /var/www/html/custom_apps/passwords/lib/Services/EnvironmentService.php on line 383 in file '/var/www/html/custom_apps/passwords/lib/Services/EnvironmentService.php' line 433 POST /index.php/apps/richdocuments/wopi/files/1795874_oc1otvjqmwhj/contents?access_token=redacted&access_token_ttl=0 von ***.***.***.*** von -- um 14.09.2024, 19:32:42

tatrapikao avatar Sep 14 '24 18:09 tatrapikao

Yeah I also see those "null given" errors, they seem to happen when I try to edit a file shared via a link that is in a groupfolder the editing user has access to anyways, so not sure if they are actually related to the "Not enough storage" error

Log {"reqId":"UwDm55YymOJGEdVJWgWa","level":3,"time":"2024-09-14T23:33:21+02:00","remoteAddr":"172.18.0.1","user":"--","app":"richdocuments","method":"POST","url":"/index.php/apps/richdocuments/wopi/files/7789833_occ4xw8zqzs4/contents?access_token=COIOvc7zkbXEVI46CoPYjEtGPkMEYxf0&access_token_ttl=0","message":"Uncaught error: OC\\Files\\View::basicOperation(): Argument #2 ($path) must be of type string, null given, called in /var/www/html/lib/private/Files/View.php on line 531 in file '/var/www/html/lib/private/Files/View.php' line 1138","userAgent":"COOLWSD HTTP Agent 24.04.7.2","version":"29.0.6.1","exception":{"Exception":"Exception","Message":"OC\\Files\\View::basicOperation(): Argument #2 ($path) must be of type string, null given, called in /var/www/html/lib/private/Files/View.php on line 531 in file '/var/www/html/lib/private/Files/View.php' line 1138","Code":0,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Richdocuments\\Controller\\WopiController"],"putFile"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":331,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Richdocuments\\Controller\\WopiController","putFile",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["7789833_occ4xw8zqzs4","richdocuments.wopi.putfile"]]},{"file":"/var/www/html/lib/base.php","line":1058,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/richdocuments/wopi/files/7789833_occ4xw8zqzs4/contents"]},{"file":"/var/www/html/index.php","line":49,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","Line":170,"Previous":{"Exception":"TypeError","Message":"OC\\Files\\View::basicOperation(): Argument #2 ($path) must be of type string, null given, called in /var/www/html/lib/private/Files/View.php on line 531","Code":0,"Trace":[{"file":"/var/www/html/lib/private/Files/View.php","line":531,"function":"basicOperation","class":"OC\\Files\\View","type":"->","args":["file_exists",null]},{"file":"/var/www/html/lib/private/Files/Filesystem.php","line":546,"function":"file_exists","class":"OC\\Files\\View","type":"->","args":[null]},{"file":"/var/www/html/apps/files_versions/lib/Storage.php","line":191,"function":"file_exists","class":"OC\\Files\\Filesystem","type":"::","args":[null]},{"file":"/var/www/html/apps/files_versions/lib/Listener/FileEventsListener.php","line":197,"function":"store","class":"OCA\\Files_Versions\\Storage","type":"::","args":[null]},{"file":"/var/www/html/apps/files_versions/lib/Listener/FileEventsListener.php","line":103,"function":"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\\BeforeNodeWrittenEvent"]]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":230,"function":"__invoke","class":"OC\\EventDispatcher\\ServiceEventListener","type":"->","args":[["OCP\\Files\\Events\\Node\\BeforeNodeWrittenEvent"],"OCP\\Files\\Events\\Node\\BeforeNodeWrittenEvent",["Symfony\\Component\\EventDispatcher\\EventDispatcher"]]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":59,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":[[["Closure"],["Closure"]],"OCP\\Files\\Events\\Node\\BeforeNodeWrittenEvent",["OCP\\Files\\Events\\Node\\BeforeNodeWrittenEvent"]]},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":86,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":[["OCP\\Files\\Events\\Node\\BeforeNodeWrittenEvent"],"OCP\\Files\\Events\\Node\\BeforeNodeWrittenEvent"]},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":98,"function":"dispatch","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":["OCP\\Files\\Events\\Node\\BeforeNodeWrittenEvent",["OCP\\Files\\Events\\Node\\BeforeNodeWrittenEvent"]]},{"file":"/var/www/html/lib/private/Files/Node/HookConnector.php","line":93,"function":"dispatchTyped","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":[["OCP\\Files\\Events\\Node\\BeforeNodeWrittenEvent"]]},{"file":"/var/www/html/lib/private/legacy/OC_Hook.php","line":105,"function":"write","class":"OC\\Files\\Node\\HookConnector","type":"->","args":[["/Admin/Sharing Test/Geht_das.odt",true]]},{"file":"/var/www/html/lib/private/Files/View.php","line":599,"function":"emit","class":"OC_Hook","type":"::","args":["OC_Filesystem","write",["/Admin/Sharing Test/Geht_das.odt",true]]},{"file":"/var/www/html/lib/private/Files/View.php","line":642,"function":"emit_file_hooks_pre","class":"OC\\Files\\View","type":"->","args":[true,"/techast/files/Admin/Sharing Test/Geht_das.odt",true]},{"file":"/var/www/html/lib/private/Files/Node/File.php","line":73,"function":"file_put_contents","class":"OC\\Files\\View","type":"->","args":["/techast/files/Admin/Sharing Test/Geht_das.odt",null]},{"file":"/var/www/html/custom_apps/richdocuments/lib/Controller/WopiController.php","line":504,"function":"putContent","class":"OC\\Files\\Node\\File","type":"->","args":[null]},{"file":"/var/www/html/custom_apps/richdocuments/lib/Controller/WopiController.php","line":796,"function":"OCA\\Richdocuments\\Controller\\{closure}","class":"OCA\\Richdocuments\\Controller\\WopiController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/richdocuments/lib/Controller/WopiController.php","line":773,"function":"retryOperation","class":"OCA\\Richdocuments\\Controller\\WopiController","type":"->","args":[["Closure"]]},{"file":"/var/www/html/lib/private/Files/Lock/LockManager.php","line":29,"function":"OCA\\Richdocuments\\Controller\\{closure}","class":"OCA\\Richdocuments\\Controller\\WopiController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/richdocuments/lib/Controller/WopiController.php","line":776,"function":"runInScope","class":"OC\\Files\\Lock\\LockManager","type":"->","args":[["OCP\\Files\\Lock\\LockContext"],["Closure"]]},{"file":"/var/www/html/custom_apps/richdocuments/lib/Controller/WopiController.php","line":503,"function":"wrappedFilesystemOperation","class":"OCA\\Richdocuments\\Controller\\WopiController","type":"->","args":[["OCA\\Richdocuments\\Db\\Wopi",54375],["Closure"]]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":232,"function":"putFile","class":"OCA\\Richdocuments\\Controller\\WopiController","type":"->","args":["7789833","COIOvc7zkbXEVI46CoPYjEtGPkMEYxf0"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":138,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Richdocuments\\Controller\\WopiController"],"putFile"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Richdocuments\\Controller\\WopiController"],"putFile"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":331,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Richdocuments\\Controller\\WopiController","putFile",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["7789833_occ4xw8zqzs4","richdocuments.wopi.putfile"]]},{"file":"/var/www/html/lib/base.php","line":1058,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/richdocuments/wopi/files/7789833_occ4xw8zqzs4/contents"]},{"file":"/var/www/html/index.php","line":49,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/Files/View.php","Line":1138},"message":"Uncaught error: OC\\Files\\View::basicOperation(): Argument #2 ($path) must be of type string, null given, called in /var/www/html/lib/private/Files/View.php on line 531 in file '/var/www/html/lib/private/Files/View.php' line 1138","exception":[],"CustomMessage":"Uncaught error: OC\\Files\\View::basicOperation(): Argument #2 ($path) must be of type string, null given, called in /var/www/html/lib/private/Files/View.php on line 531 in file '/var/www/html/lib/private/Files/View.php' line 1138"},"id":"66e6012823b4f"}

jugendhacker avatar Sep 14 '24 21:09 jugendhacker

I since then have migrated from a docker COOL to a repository COOL and the "no storage error" disappeared. I still get the "no permissions" error on every document either shared with me or located in a group folder,

~~except for some old group folders that exist since at least 3 Years and documents located there work completely fine.~~

tatrapikao avatar Sep 15 '24 11:09 tatrapikao

I have a very similiar issue that might be realted? - CollaboraOnline/online#9328 After the error about permissions grafik was blamed on groupfolders i decided to migrate to a classic shared folder. While i was doing so, richdocuments started to throw the following error refusing to open any document anywhere in nextcloud: "Kein Festplattenplatz mehr auf dem Server" grafik (not enough diskspace ) wich was fixed by restarting the instance but came back just a couple of minutes later. In the time between the restarts i could test enough to notice richdocuments now als throwing the first error in normal shared folders. In the logs i find a ton of: [richdocuments] Fehler: Uncaught error: OCA\Passwords\Services\EnvironmentService::loadUserFromBearerAuth(): Argument #1 ($userId) must be of type string, null given, called in /var/www/html/custom_apps/passwords/lib/Services/EnvironmentService.php on line 383 in file '/var/www/html/custom_apps/passwords/lib/Services/EnvironmentService.php' line 433 POST /index.php/apps/richdocuments/wopi/files/1795874_oc1otvjqmwhj/contents?access_token=redacted&access_token_ttl=0 von ***.***.***.*** von -- um 14.09.2024, 19:32:42

We are getting the same error in our Nextcloud instance (installed via docker-compose, according to this example) since updating to major version 29 and switching from Onlyoffice + Community Document Server to Nextcloud Office + built-in Collabora CODE.

Nextcloud Version 29.0.6 Nextcloud Office 8.4.6 Collabora CODE 24.4.702

I also see that exact Passwords error in the logs every time the "Document cannot be saved, please check your permissions" nagscreen appears for someone. I call it a nagscreen, because apparently, it does in fact save all documents successfully without fail, but it still displays the error message every few seconds and requires quitting the app on the user's side.

This seems to only happen with shared documents, but I haven't been able to find out if it's related to file formats or anything else, including how it's related to Passwords.

If there's anything I can provide or try to solve this issue, please tell me.

Update: I've tested different file formats and permission options with a colleague today and we could not prevent that error from showing up when a file was shared, no matter which format or in which shared folder it was placed (unless we've missed something).

Update 2: It appears that at least in our case this issue is directly related to the Passwords app. After just disabling that app, the error message upon saving disappears. Judging by the error logs, this might also be the case for @tatrapikao

I've also tried disabling preview generation and reviewed the proxy settings as per other comments to no success. Unfortunately, we can't really refrain from either Office or Passwords at this point, there seems to be some incompatibility.

BennoHouse avatar Sep 22 '24 09:09 BennoHouse

After digging through the code a bit, I suspect this is the reason for the Not enough storage error. It totally fits my problem (file shared from a groupfolder directly to a user)

jugendhacker avatar Oct 01 '24 14:10 jugendhacker

Maybe another helpful clue: if I share the file via a link and open this link in a browser session where I'm not logged in (e.g. private mode) it works, so the bug is most likely in the logic that handles logged in users trying to edit the file via a share

jugendhacker avatar Oct 01 '24 14:10 jugendhacker

After migrating from Docker COOL to Repo COOL i dont get the Storage Error anymore. Still there is the "no permissions" error that i get for every richdocuments document residing inside a groupfolder. The corresponding Nextcloud-Log is the one i already pasted here: https://github.com/nextcloud/richdocuments/issues/4032#issuecomment-2351086445

tatrapikao avatar Oct 13 '24 13:10 tatrapikao

In the end it was this one for me: https://github.com/marius-wieschollek/passwords/issues/671 The mentioned Workaround seems to fix the problem for the time being.

tatrapikao avatar Oct 15 '24 18:10 tatrapikao

The original report was fixed by https://github.com/nextcloud/richdocuments/pull/4301

There were a couple of other fixes with groupfolders in the latest release that were also mentioned https://github.com/CollaboraOnline/online/issues/9328 so I consider this fixed on our end.

The passwords issue is tracked separately.

juliusknorr avatar Jan 16 '25 10:01 juliusknorr