Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nextcloud resets quota every week #7300

Closed
vermaden opened this issue Nov 27, 2017 · 10 comments
Closed

Nextcloud resets quota every week #7300

vermaden opened this issue Nov 27, 2017 · 10 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap feature: ldap feature: users and groups needs info

Comments

@vermaden
Copy link

vermaden commented Nov 27, 2017

Hi,

we have strange problem with Nextcloud, we have set a quota of 4 GB on all users and then we changed it to 10 GB for some users, but every week Nextcloud resets this 10 GB into 4 GB and we have to change it into 10 GB manually.

Expected behaviour

Users that have been set with 10 GB should remain with 10 GB quota, not to change automatically into 4 GB.

Actual behaviour

Quota of 10 GB 'users' is reset every week into 4 GB.

Server configuration

Operating system: FreeBSD 11.1
Web server: Nginx 1.12
Database: PostgreSQL 9.6.3
PHP version: 7.0.21
Nextcloud version: 12.0.1
Updated from an older Nextcloud: 12.0.0

List of activated apps:

root@c003s3141:~ # sudo -u www php occ app:list
Enabled:
  - activity: 2.5.2
  - bruteforcesettings: 1.0.2
  - contacts: 1.5.3
  - dav: 1.3.0
  - federatedfilesharing: 1.2.0
  - files: 1.7.2
  - files_automatedtagging: 1.2.2
  - files_pdfviewer: 1.1.1
  - files_retention: 1.1.2
  - files_sharing: 1.4.0
  - gallery: 17.0.0
  - logreader: 2.0.0
  - lookup_server_connector: 1.0.0
  - notifications: 2.0.0
  - oauth2: 1.0.5
  - password_policy: 1.2.2
  - provisioning_api: 1.2.0
  - quota_warning: 1.0.1
  - serverinfo: 1.2.0
  - sharebymail: 1.2.0
  - systemtags: 1.2.0
  - theming: 1.3.0
  - twofactor_backupcodes: 1.1.1
  - updatenotification: 1.2.0
  - user_ldap: 1.2.1
  - workflowengine: 1.2.0
Disabled:
  - admin_audit
  - comments
  - encryption
  - federation
  - files_external
  - files_texteditor
  - files_trashbin
  - files_versions
  - files_videoplayer
  - firstrunwizard
  - mail
  - nextcloud_announcements
  - survey_client
  - user_external

Nextcloud configuration:

# sudo -u www php occ config:list system
{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "REMOVED.SENSITIVE.COM",
            "REMOVED.SENSITIVE.COM"
        ],
        "datadirectory": "\/nextcloud\/data",
        "overwrite.cli.url": "https:\/\/REMOVED.SENSITIVE.COM\/",
        "overwritehost": "REMOVED.SENSITIVE.COM",
        "overwriteprotocol": "https",
        "dbtype": "pgsql",
        "version": "12.0.1.5",
        "dbname": "nextcloud",
        "dbhost": "localhost",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "memcache.local": "\\OC\\Memcache\\Memcached",
        "memcache.distributed": "\\OC\\Memcache\\Memcached",
        "memcached_servers": [
            [
                "localhost",
                11211
            ]
        ],
        "appstoreurl": "https:\/\/apps.nextcloud.com\/api\/v0",
        "ldapIgnoreNamingRules": false,
        "ldapProviderFactory": "\\OCA\\User_LDAP\\LDAPProviderFactory",
        "remember_login_cookie_lifetime": 0,
        "session_lifetime": 60,
        "session_keepalive": false,
        "mail_smtpmode": "smtp",
        "mail_smtpauthtype": "PLAIN",
        "mail_smtphost": "CHANGED.smtp.host.com",
        "mail_smtpport": "25",
        "log_type": "syslog",
        "logfile": "",
        "loglevel": "1",
        "updater.secret": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false,
        "theme": ""
    }
}

Regards,
vermaden

@MorrisJobke
Copy link
Member

@vermaden Could it be that you configured LDAP that it fetches the quota as well? This would explain why it is "reset".

cc @nextcloud/ldap for analysis

@MorrisJobke MorrisJobke added 0. Needs triage Pending check for reproducibility or if it fits our roadmap feature: ldap feature: users and groups needs info labels Nov 27, 2017
@blizzz
Copy link
Member

blizzz commented Nov 27, 2017

and if you manage it via LDAP you cannot mix it with local quota settings.

@vermaden
Copy link
Author

How to set it with LDAP then?

@vermaden
Copy link
Author

Thank You for help, I will dig that path.

@pacija
Copy link

pacija commented Dec 12, 2017

One of my LDAP users just called me that his quota has decreased from 10Gb (set directly in NC for that particular user) to 1Gb (default). I see other users whose quotas did not decrease, but they didn't login recently. I don't have anything set in Quota Field of Special Attributes.

My environment:
Nextcloud Version: nextcloud-12.0.3
OS: FreeBSD 11.1-RELEASE-p6
HTTP Server: apache24-2.4.29
PHP Version: php70-7.0.26_1
Database: mysql56-server-5.6.38

I'd be glad to help with patch testing, if any.

@blizzz blizzz reopened this Dec 12, 2017
@blizzz
Copy link
Member

blizzz commented Dec 12, 2017

@pacija can you apply the debug patch:

diff --git a/lib/private/User/User.php b/lib/private/User/User.php
index 645f7b8e59..812aaabdc4 100644
--- a/lib/private/User/User.php
+++ b/lib/private/User/User.php
@@ -390,6 +390,7 @@ class User implements IUser {
 	 * @since 9.0.0
 	 */
 	public function setQuota($quota) {
+		\OC::$server->getLogger()->logException(new \Exception('Quota changed for ' . $this->uid . ' to ' . $quota));
 		$oldQuota = $this->config->getUserValue($this->uid, 'files', 'quota', '');
 		if($quota !== 'none' and $quota !== 'default') {
 			$quota = OC_Helper::computerFileSize($quota);

And whenever it happens next, check the log for "Quota changed for" and past the line? It will provide is the backtrace.

@pacija
Copy link

pacija commented Dec 13, 2017

I applied the diff, I'm going to monitor logs for quota changes.

I have increased quota for myself, logged out/in in hope it will be reset, but so far it didn't. I got backtrace for my manual quota increase though:

Exception: Quota changed for FE4BA47B-037D-4F86-8ED3-A9C7C6719D5D to 10 GB

    /usr/local/www/nextcloud/settings/ajax/setquota.php - line 68: OC\User\User->setQuota('10 GB')
    /usr/local/www/nextcloud/lib/private/Route/Route.php - line 155): runtime-created function(1) require_once('/usr/local/www/...')
    [internal function] __lambda_func(NULL)
    /usr/local/www/nextcloud/lib/private/Route/Router.php - line 299: call_user_func('\x00lambda_22040', Array)
    /usr/local/www/nextcloud/lib/base.php - line 1004: OC\Route\Router->match('/settings/ajax/...')
    /usr/local/www/nextcloud/index.php - line 48: OC handleRequest()
    {main}

I also see these in log, right after my manual quota change:

Warning | no app in context | Missing expected parameters in change user hook

Regarding user whose quota was reset, I see the following (I changed the UUID to all Xs):

Warning | user_ldap | not suitable default quota found for user XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX: []

Hopefully some dev can figure out something out of this. In the meantime, I'm here for any testing needed to solve the problem.

Thank you in advance.

@pacija
Copy link

pacija commented Dec 18, 2017

@blizzz

Ok, here's the backtrace:

Exception: Quota changed for 0A69CA90-7061-43EE-BB8F-1BD1E3AE8ED1 to default

    /usr/local/www/nextcloud/apps/user_ldap/lib/User/User.php - line 532: OC\User\User->setQuota('default')
    /usr/local/www/nextcloud/apps/user_ldap/lib/User/User.php - line 161: OCA\User_LDAP\User\User->updateQuota()
    /usr/local/www/nextcloud/apps/user_ldap/lib/User_LDAP.php - line 338: OCA\User_LDAP\User\User->update()
    [internal function] OCA\User_LDAP\User_LDAP->userExists('0A69CA90-7061-4...')
    /usr/local/www/nextcloud/apps/user_ldap/lib/User_Proxy.php - line 98: call_user_func_array(Array, Array)
    /usr/local/www/nextcloud/apps/user_ldap/lib/Proxy.php - line 148: OCA\User_LDAP\User_Proxy->callOnLastSeenOn('0A69CA90-7061-4...', 'userExists', Array, false)
    /usr/local/www/nextcloud/apps/user_ldap/lib/User_Proxy.php - line 163: OCA\User_LDAP\Proxy->handleRequest('0A69CA90-7061-4...', 'userExists', Array)
    /usr/local/www/nextcloud/lib/private/User/Manager.php - line 137: OCA\User_LDAP\User_Proxy->userExists('0A69CA90-7061-4...')
    /usr/local/www/nextcloud/apps/spreed/lib/Activity/Provider.php - line 195: OC\User\Manager->get('0A69CA90-7061-4...')
    /usr/local/www/nextcloud/apps/spreed/lib/Activity/Provider.php - line 180: OCA\Spreed\Activity\Provider->getDisplayName('0A69CA90-7061-4...')
    /usr/local/www/nextcloud/apps/spreed/lib/Activity/Provider.php - line 138: OCA\Spreed\Activity\Provider->getUser('0A69CA90-7061-4...')
    /usr/local/www/nextcloud/apps/spreed/lib/Activity/Provider.php - line 93: OCA\Spreed\Activity\Provider->getParameters(Array)
    /usr/local/www/nextcloud/apps/activity/lib/GroupHelper.php - line 96: OCA\Spreed\Activity\Provider->parse('en', Object(OC\Activity\Event), Object(OC\Activity\Event))
    /usr/local/www/nextcloud/apps/activity/lib/Data.php - line 265: OCA\Activity\GroupHelper->addActivity(Array)
    /usr/local/www/nextcloud/apps/activity/lib/Controller/APIv1.php - line 90: OCA\Activity\Data->get(Object(OCA\Activity\GroupHelper), Object(OCA\Activity\UserSettings), 'A375A9FB-2917-4...', 0, 29, 'desc', 'all')
    [internal function] OCA\Activity\Controller\APIv1->get(0, 30)
    /usr/local/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 160: call_user_func_array(Array, Array)
    /usr/local/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 90: OC\AppFramework\Http\Dispatcher->executeController(Object(OCA\Activity\Controller\APIv1), 'get')
    /usr/local/www/nextcloud/lib/private/AppFramework/App.php - line 114: OC\AppFramework\Http\Dispatcher->dispatch(Object(OCA\Activity\Controller\APIv1), 'get')
    /usr/local/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47: OC\AppFramework\App main('APIv1Controller', 'get', Object(OC\AppFramework\DependencyInjection\DIContainer), Array)
    [internal function] OC\AppFramework\Routing\RouteActionHandler->__invoke(Array)
    /usr/local/www/nextcloud/lib/private/Route/Router.php - line 299: call_user_func(Object(OC\AppFramework\Routing\RouteActionHandler), Array)
    /usr/local/www/nextcloud/ocs/v1.php - line 77: OC\Route\Router->match('/ocsapp/cloud/a...')
    {main}

I see 12.0.4 is out. I'd like to update from 12.0.3, but if needed for the purpose of troubleshooting I'll remain on 12.0.3 until this is sorted out.

@blizzz
Copy link
Member

blizzz commented Dec 18, 2017

@pacija this is fixed in 12.0.4 by #6910 I had totally forgotten about that PR 😳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap feature: ldap feature: users and groups needs info
Projects
None yet
Development

No branches or pull requests

4 participants