server icon indicating copy to clipboard operation
server copied to clipboard

[Bug]: Insufficient Storage Error does not name user (nextcloud.log, android, desktop)

Open lightonflux opened this issue 2 years ago • 5 comments

⚠️ This issue respects the following points: ⚠️

  • [X] This is a bug, not a question or a configuration/webserver/proxy issue.
  • [X] This issue is not already reported on Github (I've searched it).
  • [X] Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • [X] Nextcloud Server is running on 64bit capable CPU, PHP and OS.
  • [X] I agree to follow Nextcloud's Code of Conduct.

Bug description

Situation: My user uses a shared folder "project" from user Sarah. Sarah's user does not have sufficient space. my user tries to upload files from an android app or desktop app and gets an error message about insufficient space. Sadly, neither the apps nor the nextcloud.log on the server state that the "project" does not count towards the quota by my user. Only when uploading via the web UI the error message names Sarah's account.

Imagine a not too uncommon structure like this, which can add to the confusion which user a folder “belongs to”.

Project
├── Photos
│   ├── lightonflux
│   ├── sarah
│   └── steven12
└── Videos
    ├── lightonflux
    ├── sarah
    └── steven12

Steps to reproduce

  1. Create new user A with very little space
  2. Share folder from that user A with another user B that has ample space.
  3. The user B uploads files until the quota of user A is reached

Expected behavior

The error messages in the log file (nextcloud.log) and all apps should tell which user the storage/folder that has insufficient space belongs to.

Installation method

Community Manual installation with Archive

Nextcloud Server version

25

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Nginx

Database engine version

MySQL

Is this bug present after an update or on a fresh install?

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • [X] Default user-backend (database)
  • [ ] LDAP/ Active Directory
  • [ ] SSO - SAML
  • [ ] Other

Configuration report

No response

List of activated Apps

Not relevant.

Nextcloud Signing status

No response

Nextcloud Logs

# Note that the subfolder "lightonflux" actually belongs to another user, because the parent "Project" does as well. 


{"reqId":"nIS2Hh4ZCpNpMz","level":3,"time":"2023-03-31T12:04:28+00:00","remoteAddr":"IP_ADDR","user":"lightonflux","app":"webdav","method":"MOVE","url":"/remote.php/dav/uploads/lightonflux/567002973/.file","message":"Insufficient space in /Project/Videos/lightonflux, 27136230 required, 343725 available","userAgent":"Mozilla/5.0 (Linux) mirall/3.7.4git (Nextcloud, fedora-6.2.8-200.fc37.x86_64 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"25.0.5.1","exception":{"Exception":"Sabre\\DAV\\Exception\\InsufficientStorage","Message":"Insufficient space in /Project/Videos/lightonflux, 27136230 required, 343725 available","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/QuotaPlugin.php","line":142,"function":"checkQuota","class":"OCA\\DAV\\Connector\\Sabre\\QuotaPlugin","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"beforeMove","class":"OCA\\DAV\\Connector\\Sabre\\QuotaPlugin","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":603,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpMove","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Server.php","line":360,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/remote.php","line":171,"args":["/var/www/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/QuotaPlugin.php","Line":210,"message":"Insufficient space in /Project/Videos/lightonflux, 27136230 required, 343725 available","exception":{},"CustomMessage":"Insufficient space in /Project/Videos/lightonflux, 27136230 required, 343725 available"}}

Additional info

No response

lightonflux avatar Mar 31 '23 13:03 lightonflux

I took a look at this and agree this would be helpful.

What I'm unclear on about in your report, @lightonflux, is that you stated:

Only when uploading via the web UI the error message names Sarah's account.

That isn't my experience in testing (until I made a code change). The Web UI does display a more useful error message than Android, but the Web UI error message is simply what's sent to nextcloud.log (Insufficient space in /Project/Videos/lightonflux, 27136230 required, 343725 available).

In Android I don't even get an error message on the client side other than Unknown error and it's buried under the Uploads status section of the interface (which might be fine a place for additional error information except the upload fails silently for the user otherwise unless they go back to check there).

Am I missing something in your report? Are you/your users seeing Insufficient space errors on Android?

I agree the error output needs to be changed, but to me the issues are:

  • Web UI - needs owner information in error message
  • Log file - needs owner information in error message
  • Android - needs a more useful error than "Unknown error" in the Uploads status section when the failure is due to insufficient space
  • Android - shouldn't fail semi-silently or a user might think the upload went fine and eliminate their local copy
  • Android - needs owner information in error message
  • iOS - didn't look at these
  • Desktop - didn't look at these

I have a preliminary change in my dev environment that adds the owner to the log output used by both nextcloud.log and the Web UI.

Current behavior:

Insufficient space in /QuotaShareTest, 355643392 required, 305008036 available Insufficient space in /Project/Videos/lightonflux, 27136230 required, 343725 available

New behavior:

Insufficient space in /QuotaShareTest (owned by josh), 355643392 required, 305008036 available Insufficient space in /Project/Videos/lightonflux (owned by sarah), 27136230 required, 343725 available

For the nextcloud.log and Web UI is the above the direction you were hoping for?

joshtrichards avatar Apr 01 '23 17:04 joshtrichards

Breadcrumbs: https://github.com/nextcloud/android/issues/1783

joshtrichards avatar Apr 01 '23 18:04 joshtrichards

Oh I see the different Android (and Web) behavior @lightonflux now:

Current Behavior

Android

  • Upload: (what I was testing with): Silent failure after doing a full upload. If user happens to check the Uploads status section there is a generic Unknown error (as noted above)
  • Copy: A simple Insufficient space message is properly displayed albeit it lacks the info this issue is requesting
  • Move: I get a super vague (but at least not silent like the Upload) You are not permitted to move this file for anything sufficiently big enough to trigger the quota

Web UI:

  • Upload: Insufficient space in /Project/Videos/lightonflux, 27136230 required, 343725 available
  • Move or Copy: Could not move "xxx.txt"
  • Copy: Could not copy "xxx.txt"

Next Steps

After I get confirmation back from you that my adjustments in the server component (log file and Web UI) are in the right direction, I'll extend my current changes to the Move and Copy modes (in the Web UI) and submit the code change. That'll take care of the four situations in Server.

Suggestion

Any adjustments to the Android side are are obviously going to have to broken out into the appropriate repo (https://github.com/nextcloud/android/issues) and tracked there.

Same for Desktop (https://github.com/nextcloud/desktop/issues).

If applicable, IOS (https://github.com/nextcloud/ios) too.

I haven't checked for any pre-existing reported issues or related tracked work in those repos.

If you want to keep the ball rolling to get similar enhancements done for Android and Desktop, please search their existing issues for ones that seem the same, and, if applicable, open new issues in those places if you want to keep things moving.

Make sure to reference this issue too for context. :)

Final comments

At least we can get the server side bits knocked out I think with the work I've got in progress.

joshtrichards avatar Apr 01 '23 18:04 joshtrichards

I think there is an opportunity here to clean up the messaging and make it more consistent across the board. In addition, insufficient space is vague and potentially misleading for both end-users and admins as it doesn't distinguish between server-side issues outside the user's control (e.g. a full disk) versus issues that the client has some ability to resolve or address through a non-admin collaborator (e.g. quota exceeded).

Proposed (for quota exceeded issues)

Web UI:

Could not upload "xxx.txt" - quota exceeded in /target (owner: sarah) 355643392 required, 305008036 available Could not copy "xxx.txt" - quota exceeded in /target (owner: sarah), 355643392 required, 305008036 available Could not move "xxx.txt" - quota exceeded in /target (owner: sarah), 355643392 required, 305008036 available

Logging:

Could not upload "xxx.txt" - quota exceeded in /target (owner: sarah), 355643392 required, 305008036 available Could not copy "xxx.txt" - quota exceeded in /target (owner: sarah), 355643392 required, 305008036 available Could not move "xxx.txt" - quota exceeded in /target (owner: sarah), 355643392 required, 305008036 available

Additional notes

  • If I find the time to get fancy I'll make the owner: xxx appear only if the owner doesn't match the requesting user.

Post-implementation follow-up items (out of scope)

  • Create a counterpart issue to clean-up messaging in Android for quotas being exceeded
  • Check on Desktop messaging for quotas being exceeded
  • Check on IOS messaging for quotas being exceeded
  • See if there is any way to reduce the impact of intermediate files (chunks) on the "available space" from the user's perspective
  • Check on messaging used for actual insufficient disk space (i.e. non-quota related upload/move/copy failures)

joshtrichards avatar Apr 02 '23 17:04 joshtrichards

Am I missing something in your report? Are you/your users seeing Insufficient space errors on Android?

Yes, i saw a combination of insufficient space and gateway timeout errors. But i switched modes for testing, so i guess it was in copy mode. But i switched back "keep original" in the android app, and i think the insufficient message was still triggered. Currently, i cannot retest, as i would need to setup everything again and i only have limited time. Maybe next week. But i think your suggested additions already solve my problem and would have prevented needless debugging.

For the nextcloud.log and Web UI is the above the direction you were hoping for?

Yes it is! Thank you very much for your work, the messaging mentioning quotas is much more clear!

lightonflux avatar Apr 02 '23 20:04 lightonflux

Further to this, this isn't an admin problem so should not reside in the server logs. This is a client/user issue. This message should be presented to the user in the client or web UI. It has nothing to do with the administration of the server and only serves to clog up the error messages in the logging console.

I opened my settings/admin/overview page today and saw it had 1800 errors in the log and I freaked out. Then looking at the log it's mostly stuff like this space error that isn't relevant to monitoring the server health.

Justinzobel avatar Feb 25 '25 00:02 Justinzobel