nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.77k stars 4k forks source link

S3/NFSv4 - [19 Beta 2] User cannot login with quota enabled #20478

Closed SimplyCorbett closed 4 years ago

SimplyCorbett commented 4 years ago

EDIT: This also happens with NFSv4 mounted locally, mounted on the data directory. So it's not just S3. NFSv4 error is a few posts down.

With an indexless primary S3 bucket if a user is assigned quota they are unable to login to nextcloud. However, if they have unlimited quota they can login fine.

Why does this matter? Nextcloud should be keeping track of everything on the bucket internally. It should not be querying the bucket at all for user information.

Steps to reproduce

  1. Enable indexless S3 bucket
  2. Add quota to user in the user menu
  3. Login as user. Login fails.

Expected behaviour

Tell us what should happen

User can have quota enabled and login fine

Actual behaviour

Tell us what happens instead

User cannot login with quota enabled on their account

Server configuration

Operating system: Debian 10 Web server: Nginx Database: Postgresql PHP version: 7.4-fpm Nextcloud version: (see Nextcloud admin page) 19 beta 2 Updated from an older Nextcloud/ownCloud or fresh install: No Where did you install Nextcloud from: Nextcloud website

<
?php
$CONFIG = array (
  'objectstore' =>
  array (
    'class' => 'OC\\Files\\ObjectStore\\S3',
    'arguments' =>
    array (
      'bucket' => 'drive',
      'autocreate' => true,
      'key' => '',
      'secret' => '',
      'hostname' => 'sasfasfase',
      'port' => 443,
      'use_ssl' => true,
      'region' => 'default',
      'use_path_style' => false,
    ),
  ),
  'trusted_domains' =>
  array (
    0 => 'driasfasfe',
  ),
  'trusted_proxies' =>
  array (
    0 => '192.168.5.1',
    1 => '2asfas',
    2 => '205asfasfas6',
    3 => '205.1asfasf',
  ),
  'overwrite.cli.url' => 'httasfas',
  'overwritehost' => 'dasfas',
  'overwriteprotocol' => 'https',
  'overwritewebroot' => '/',
  'filelocking.enabled' => false,
  'instanceid' => '',
  'passwordsalt' => '',
  'secret' => '',
  'datadirectory' => '/var/www/drive/data',
  'dbtype' => 'pgsql',
  'version' => '19.0.0.3',
  'dbname' => 'drive',
  'dbhost' => '10.0.1.3',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'drive',
  'dbpassword' => 'e',
  'installed' => true,
  'loglevel' => 1,
  'preview_max_x' => '2048',
  'preview_max_y' => '2048',
  'jpeg_quality' => '80',
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'noreply',
  'mail_domain' => 'iasfas',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'smtp.sendgrid.net',
  'mail_smtpport' => '587',
  'mail_smtpname' => 'apikey',
  'mail_smtppassword' => ',
  'mail_smtpauthtype' => 'LOGIN',
  'quota_include_external_storage' => false,
  'filesystem_check_changes' => 0,
  'trashbin_retention_obligation' => '7, 14',
  'enabledPreviewProviders' =>
  array (
    0 => 'OC\\Preview\\PNG',
    1 => 'OC\\Preview\\PDF',
    2 => 'OC\\Preview\\JPEG',
    3 => 'OC\\Preview\\GIF',
    4 => 'OC\\Preview\\HEIC',
    5 => 'OC\\Preview\\BMP',
    6 => 'OC\\Preview\\XBitmap',
    7 => 'OC\\Preview\\MP3',
    8 => 'OC\\Preview\\TXT',
    9 => 'OC\\Preview\\MarkDown',
    10 => 'OC\\Preview\\Movie',
    11 => 'OC\\Preview\\TIFF',
    12 => 'OC\\Preview\\Photoshop',
  ),
  'app_install_overwrite' =>
  array (
    0 => 'passman',
    1 => 'camerarawpreviews',
    2 => 'files_photospheres',
    3 => 'documentserver_community',
  ),
);

Other settings

No encryption Fresh install Minimal apps (passman, calendar, contacts, metadata, photo sphere viewer, community document server) No external storage No LDAP Firefox Browser

Error:

{"reqId":"Y15ZKQwcStqJKZlz5icO","level":3,"time":"2020-04-14T16:25:56+00:00","remoteAddr":"10.0.1.10","user":"paradox","app":"index","method":"POST","url":"/index.php","message":{"Exception":"Exception","Message":"Call to a member function getSize() on bool","Code":0,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/App.php","line":136,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->"},{"file":"/var/www/html/lib/private/Route/Router.php","line":299,"function":"call_user_func"},{"file":"/var/www/html/lib/base.php","line":1012,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/html/index.php","line":38,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","Line":109,"Previous":{"Exception":"Error","Message":"Call to a member function getSize() on bool","Code":0,"Trace":[{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Quota.php","line":100,"function":"getSize","class":"OC\\Files\\Storage\\Wrapper\\Quota","type":"->"},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Quota.php","line":216,"function":"free_space","class":"OC\\Files\\Storage\\Wrapper\\Quota","type":"->"},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php","line":83,"function":"mkdir","class":"OC\\Files\\Storage\\Wrapper\\Quota","type":"->"},{"file":"/var/www/html/lib/private/Files/View.php","line":1163,"function":"mkdir","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/var/www/html/lib/private/Files/View.php","line":270,"function":"basicOperation","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/html/lib/private/Files/Node/Folder.php","line":164,"function":"mkdir","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/html/lib/private/Files/Node/Root.php","line":386,"function":"newFolder","class":"OC\\Files\\Node\\Folder","type":"->"},{"function":"getUserFolder","class":"OC\\Files\\Node\\Root","type":"->"},{"file":"/var/www/html/lib/private/Files/Node/LazyRoot.php","line":66,"function":"call_user_func_array"},{"file":"/var/www/html/lib/private/Files/Node/LazyRoot.php","line":283,"function":"__call","class":"OC\\Files\\Node\\LazyRoot","type":"->"},{"file":"/var/www/html/lib/private/Server.php","line":1556,"function":"getUserFolder","class":"OC\\Files\\Node\\LazyRoot","type":"->"},{"file":"/var/www/html/lib/private/User/Session.php","line":556,"function":"getUserFolder","class":"OC\\Server","type":"->"},{"file":"/var/www/html/lib/private/User/Session.php","line":415,"function":"prepareUserLogin","class":"OC\\User\\Session","type":"->"},{"file":"/var/www/html/lib/private/Authentication/Login/CompleteLoginCommand.php","line":44,"function":"completeLogin","class":"OC\\User\\Session","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/Authentication/Login/ALoginCommand.php","line":40,"function":"process","class":"OC\\Authentication\\Login\\CompleteLoginCommand","type":"->"},{"file":"/var/www/html/lib/private/Authentication/Login/LoggedInCheckCommand.php","line":60,"function":"processNextOrFinishSuccessfully","class":"OC\\Authentication\\Login\\ALoginCommand","type":"->"},{"file":"/var/www/html/lib/private/Authentication/Login/ALoginCommand.php","line":40,"function":"process","class":"OC\\Authentication\\Login\\LoggedInCheckCommand","type":"->"},{"file":"/var/www/html/lib/private/Authentication/Login/EmailLoginCommand.php","line":58,"function":"processNextOrFinishSuccessfully","class":"OC\\Authentication\\Login\\ALoginCommand","type":"->"},{"file":"/var/www/html/lib/private/Authentication/Login/ALoginCommand.php","line":40,"function":"process","class":"OC\\Authentication\\Login\\EmailLoginCommand","type":"->"},{"file":"/var/www/html/lib/private/Authentication/Login/UidLoginCommand.php","line":54,"function":"processNextOrFinishSuccessfully","class":"OC\\Authentication\\Login\\ALoginCommand","type":"->"},{"file":"/var/www/html/lib/private/Authentication/Login/ALoginCommand.php","line":40,"function":"process","class":"OC\\Authentication\\Login\\UidLoginCommand","type":"->"},{"file":"/var/www/html/lib/private/Authentication/Login/UserDisabledCheckCommand.php","line":57,"function":"processNextOrFinishSuccessfully","class":"OC\\Authentication\\Login\\ALoginCommand","type":"->"},{"file":"/var/www/html/lib/private/Authentication/Login/ALoginCommand.php","line":40,"function":"process","class":"OC\\Authentication\\Login\\UserDisabledCheckCommand","type":"->"},{"file":"/var/www/html/lib/private/Authentication/Login/PreLoginHookCommand.php","line":53,"function":"processNextOrFinishSuccessfully","class":"OC\\Authentication\\Login\\ALoginCommand","type":"->"},{"file":"/var/www/html/lib/private/Authentication/Login/Chain.php","line":108,"function":"process","class":"OC\\Authentication\\Login\\PreLoginHookCommand","type":"->"},{"file":"/var/www/html/core/Controller/LoginController.php","line":307,"function":"process","class":"OC\\Authentication\\Login\\Chain","type":"->"},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":170,"function":"tryLogin","class":"OC\\Core\\Controller\\LoginController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":136,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->"},{"file":"/var/www/html/lib/private/Route/Router.php","line":299,"function":"call_user_func"},{"file":"/var/www/html/lib/base.php","line":1012,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/html/index.php","line":38,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/html/lib/private/Files/Storage/Wrapper/Quota.php","Line":74},"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0","version":"19.0.0.3"}

Configuration: 19 beta 2 Primary S3 storage | path style false Debian 10 PHP 7.4-FPM HAProxy + Nginx Postgresql

kesselb commented 4 years ago

Issue Template?

SimplyCorbett commented 4 years ago

Issue Template?

I can, but from what I can see this is going to occur with any indexless S3 bucket. Indexless meaning you can't lookup all of the files in the bucket. There is no sharding. Nextcloud is in charge of everything, including orphaned files. There is no equivalent to ls -l

In exchange for this you can store as many files as you want on the bucket without much performance impact.

Since nextcloud is handling the primary S3 directly anyway bucket sharding/indexing is not needed and a waste of resources. I have confirmed file creation/viewing/deletion works fine, so this is specifically a quota bug.

Well, I can't verify the file is actually deleted on the backend. But there don't appear to be any errors stating otherwise.

Steps to reproduce

  1. Enable indexless S3 bucket
  2. Add quota to user in the user menu
  3. Login as user. Login fails.

Expected behaviour

Tell us what should happen

User can have quota enabled and login fine

Actual behaviour

Tell us what happens instead

User cannot login with quota enabled on their account

Server configuration

Operating system: Debian 10 Web server: Nginx Database: Postgresql PHP version: 7.4-fpm Nextcloud version: (see Nextcloud admin page) 19 beta 2 Updated from an older Nextcloud/ownCloud or fresh install: No Where did you install Nextcloud from: Nextcloud website

Other settings

No encryption Fresh install Minimal apps (passman, calendar, contacts, metadata, photo sphere viewer, community document server) No external storage No LDAP Firefox Browser

kesselb commented 4 years ago

The template is not there because someone had fun creating it. That might be a regression of https://github.com/nextcloud/server/pull/19782 if 'quota_include_external_storage' => true,. That's the reason we usually ask for the configuration. It's not a big challenge to put together the requested information but makes triaging issues much easier.

SimplyCorbett commented 4 years ago

The template is not there because someone had fun creating it. That might be a regression of #19782 if 'quota_include_external_storage' => true,. That's the reason we usually ask for the configuration. It's not a big challenge to put together the requested information but makes triaging issues much easier.

I understand but I'm not sure what other information you need for this bug. I can provide more information on my S3 setup if needed. I listed the bug in the OP.

Sorry, not trying to be difficult here. Let me know what you need and I will provide it.

kesselb commented 4 years ago

Let me know what you need and I will provide it.

Please edit the first post and add: https://github.com/nextcloud/server/blob/master/.github/ISSUE_TEMPLATE/Bug_report.md

kesselb commented 4 years ago

For some reason you decided to not provide the configuration (that was actually the important thing). Is quota_include_external_storage true or false? If true is the same happening with false?

Add that information to the first post.

SimplyCorbett commented 4 years ago

It's not enabled. It's a fresh install without external storage.

SimplyCorbett commented 4 years ago

@kesselb It turns out this is not a S3 error. It happens with NFS v4 mounted locally (so nextcloud shouldnt be able to tell it's NFS) as well.

SimplyCorbett commented 4 years ago

NFSv4 Error:

{"reqId":"Ir23VHRbM5sY63YI9dJf","level":1,"time":"2020-04-15T09:20:55+00:00","remoteAddr":"10.0.1.10","user":"paradox","app":"no app in context","method":"POST","url":"/index.php","message":"Deprecated event type for \\OCP\\Files::preCreate: Symfony\\Component\\EventDispatcher\\GenericEvent","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0","version":"19.0.0.3"} {"reqId":"Ir23VHRbM5sY63YI9dJf","level":3,"time":"2020-04-15T09:20:55+00:00","remoteAddr":"10.0.1.10","user":"paradox","app":"index","method":"POST","url":"/index.php","message":{"Exception":"Exception","Message":"Call to a member function getSize() on bool","Code":0,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/App.php","line":136,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->"},{"file":"/var/www/html/lib/private/Route/Router.php","line":299,"function":"call_user_func"},{"file":"/var/www/html/lib/base.php","line":1012,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/html/index.php","line":38,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","Line":109,"Previous":{"Exception":"Error","Message":"Call to a member function getSize() on bool","Code":0,"Trace":[{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Quota.php","line":100,"function":"getSize","class":"OC\\Files\\Storage\\Wrapper\\Quota","type":"->"},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Quota.php","line":216,"function":"free_space","class":"OC\\Files\\Storage\\Wrapper\\Quota","type":"->"},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php","line":83,"function":"mkdir","class":"OC\\Files\\Storage\\Wrapper\\Quota","type":"->"},{"file":"/var/www/html/lib/private/Files/View.php","line":1163,"function":"mkdir","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/var/www/html/lib/private/Files/View.php","line":270,"function":"basicOperation","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/html/lib/private/Files/Node/Folder.php","line":164,"function":"mkdir","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/html/lib/private/Files/Node/Root.php","line":386,"function":"newFolder","class":"OC\\Files\\Node\\Folder","type":"->"},{"function":"getUserFolder","class":"OC\\Files\\Node\\Root","type":"->"},{"file":"/var/www/html/lib/private/Files/Node/LazyRoot.php","line":66,"function":"call_user_func_array"},{"file":"/var/www/html/lib/private/Files/Node/LazyRoot.php","line":283,"function":"__call","class":"OC\\Files\\Node\\LazyRoot","type":"->"},{"file":"/var/www/html/lib/private/Server.php","line":1556,"function":"getUserFolder","class":"OC\\Files\\Node\\LazyRoot","type":"->"},{"file":"/var/www/html/lib/private/User/Session.php","line":556,"function":"getUserFolder","class":"OC\\Server","type":"->"},{"file":"/var/www/html/lib/private/User/Session.php","line":415,"function":"prepareUserLogin","class":"OC\\User\\Session","type":"->"},{"file":"/var/www/html/lib/private/Authentication/Login/CompleteLoginCommand.php","line":44,"function":"completeLogin","class":"OC\\User\\Session","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/Authentication/Login/ALoginCommand.php","line":40,"function":"process","class":"OC\\Authentication\\Login\\CompleteLoginCommand","type":"->"},{"file":"/var/www/html/lib/private/Authentication/Login/LoggedInCheckCommand.php","line":60,"function":"processNextOrFinishSuccessfully","class":"OC\\Authentication\\Login\\ALoginCommand","type":"->"},{"file":"/var/www/html/lib/private/Authentication/Login/ALoginCommand.php","line":40,"function":"process","class":"OC\\Authentication\\Login\\LoggedInCheckCommand","type":"->"},{"file":"/var/www/html/lib/private/Authentication/Login/EmailLoginCommand.php","line":58,"function":"processNextOrFinishSuccessfully","class":"OC\\Authentication\\Login\\ALoginCommand","type":"->"},{"file":"/var/www/html/lib/private/Authentication/Login/ALoginCommand.php","line":40,"function":"process","class":"OC\\Authentication\\Login\\EmailLoginCommand","type":"->"},{"file":"/var/www/html/lib/private/Authentication/Login/UidLoginCommand.php","line":54,"function":"processNextOrFinishSuccessfully","class":"OC\\Authentication\\Login\\ALoginCommand","type":"->"},{"file":"/var/www/html/lib/private/Authentication/Login/ALoginCommand.php","line":40,"function":"process","class":"OC\\Authentication\\Login\\UidLoginCommand","type":"->"},{"file":"/var/www/html/lib/private/Authentication/Login/UserDisabledCheckCommand.php","line":57,"function":"processNextOrFinishSuccessfully","class":"OC\\Authentication\\Login\\ALoginCommand","type":"->"},{"file":"/var/www/html/lib/private/Authentication/Login/ALoginCommand.php","line":40,"function":"process","class":"OC\\Authentication\\Login\\UserDisabledCheckCommand","type":"->"},{"file":"/var/www/html/lib/private/Authentication/Login/PreLoginHookCommand.php","line":53,"function":"processNextOrFinishSuccessfully","class":"OC\\Authentication\\Login\\ALoginCommand","type":"->"},{"file":"/var/www/html/lib/private/Authentication/Login/Chain.php","line":108,"function":"process","class":"OC\\Authentication\\Login\\PreLoginHookCommand","type":"->"},{"file":"/var/www/html/core/Controller/LoginController.php","line":307,"function":"process","class":"OC\\Authentication\\Login\\Chain","type":"->"},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":170,"function":"tryLogin","class":"OC\\Core\\Controller\\LoginController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":136,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->"},{"file":"/var/www/html/lib/private/Route/Router.php","line":299,"function":"call_user_func"},{"file":"/var/www/html/lib/base.php","line":1012,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/html/index.php","line":38,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/html/lib/private/Files/Storage/Wrapper/Quota.php","Line":74},"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0","version":"19.0.0.3"}

SimplyCorbett commented 4 years ago

This is not fixed in the master branch.

SimplyCorbett commented 4 years ago

S3 is fixed in beta4.