server icon indicating copy to clipboard operation
server copied to clipboard

Slow Login and App switching after Migration to NC12

Open freumichCH opened this issue 8 years ago • 11 comments

After migration from ownCloud 9.1.6 to Nextcloud 12.0.4 we face slow loading times for the login procedure and when switching between apps. We noticed the strange phenomenon that when we click a second time (instead of waiting) on a link or button (login, app switching), the page is loaded smoothly and fast. While navigating inside an app (f.e. files) everything runs fast. No slow loading.

We have two other Nextcloud servers with a similar setup with no issues. Difference: The problematic setup has a HAProxy with loadbalancing and multiple webservers.

We suspect that the new rate limiting (trottling) mechnism and Brute Force Protection (which is disabled) causes these delays. We tried several things to solve the issue:

Disable Bruteforce app via config.php and restart Apache Add the IP Addressess of the clients who experiance this issue Add an IP address with Subnet 1 ( covering 128.0.0.0 - 255.255.255.254 ) Uninstall Bruteforce app The disabling Brute Force Protection in config.php have solved part of the problem.

Updating to NC 12.0.5 did't solved the issue

Steps to reproduce

  1. Navigate to Cloud-Service
  2. Enter Login Credentials and hit Login (3. Enter TOTP-Code and hit Login Button)

Expected behaviour

Should load much faster

Actual behaviour

Login takes approximately 17 seconds (second click on Login Button leeds to substantially faster loading time) Switching to Activity App takes approximately 17 seconds to load the App (Page) (second click on Activity app leeds to substantially faster loading time) Switching back Files app takes approximately 17 seconds to load the App (Page) (second click on Files app leeds to substantially faster loading time)

Server configuration

Operating system: Ubuntu 14.04 LTS

Web server:
Apache/2.4.7 (Ubuntu)

Database: mysql Ver 14.14 Distrib 5.5.57, for debian-linux-gnu (x86_64) using readline 6.3

PHP version: Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.26-2+ubuntu14.04.1+deb.sury.org+2

Nextcloud version: NC 12.0.5 Updated from an older Nextcloud/ownCloud or fresh install: Update from OC 9.1.6

Where did you install Nextcloud from: wget from nextcloud.com

Signing status:

Signing status Integrity checker has been disabled. Integrity cannot be verified.

List of activated apps:

App list Enabled: - activity: 2.5.2 - admin_audit: 1.2.0 - admin_notifications: 1.0.1 - apporder: 0.4.1 - bookmarks: 0.10.1 - calendar: 1.5.7 - comments: 1.2.0 - contacts: 2.1.0 - dav: 1.3.1 - external: 2.0.3 - federatedfilesharing: 1.2.0 - files: 1.7.2 - files_pdfviewer: 1.1.1 - files_sharing: 1.4.0 - files_texteditor: 2.4.1 - files_trashbin: 1.2.0 - files_versions: 1.5.0 - files_videoplayer: 1.1.0 - firstrunwizard: 2.1 - gallery: 17.0.0 - logreader: 2.0.0 - lookup_server_connector: 1.0.0 - nextcloud_announcements: 1.1 - notifications: 2.0.0 - oauth2: 1.0.5 - password_policy: 1.2.2 - piwik: 0.3.2 - provisioning_api: 1.2.0 - rainloop: 5.0.6 - serverinfo: 1.2.0 - sharebymail: 1.2.0 - storageanalyzer: 0.0.1 - systemtags: 1.2.0 - twofactor_backupcodes: 1.1.1 - twofactor_totp: 1.3.1 - updatenotification: 1.2.0 - user_usage_report: 1.0.1 - workflowengine: 1.2.0 Disabled: - audioplayer - bruteforcesettings - encryption - federation - files_external - impersonate - piwik2 - survey_client - theming - user_external - user_ldap

Nextcloud configuration:

Config report
<?php
$CONFIG = array (
  'instanceid' => 'SENSITIVE DATA',
  'asset-pipeline.enabled' => false,
  'passwordsalt' => 'SENSITIVE DATA',
  'dbtype' => 'mysql',
  'version' => '12.0.4.3',
  'dbname' => 'owncloud',
  'dbhost' => '10.0.222.9:6033',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'SENSITIVE DATA',
  'dbpassword' => 'SENSITIVE DATA',
  'installed' => true,
  'integrity.check.disabled' => true,
  'appcodechecker' => false,
  'theme' => 'wolke',
  'forcessl' => true,
  'maintenance' => false,
  'enable_previews' => true,
  'preview_max_x' => 2048,
  'preview_max_y' => 2048,
  'session_lifetime' => 86400,
  'maxZipInputSize' => 2147483648,
  'allowZipDownload' => true,
  'trashbin_retention_obligation' => '30',
  'mail_smtpmode' => 'smtp',
  'mail_smtphost' => 'SENSITIVE DATA',
  'appstoreenabled' => true,
  'activity_expire_days' => 21,
  'versions_retention_obligation' => 'auto',
  'enable_avatars' => false,
  'logtimezone' => 'Europe/Zurich',
  'loglevel' => 0,
  'log_rotate_size' => 104857600,
  'filesystem_check_changes' => 1,
  'trusted_domains' => 
  array (
    0 => 'SENSITIVE DATA',
    1 => 'SENSITIVE DATA',
    2 => 'SENSITIVE DATA',
    3 => 'SENSITIVE DATA',
  ),
  'datadirectory' => '/mnt/nfs/data',
  'auth.bruteforce.protection.enabled' => false,
  'skeletondirectory' => '/var/www/owncloud/themes/wolke/core/skeleton/',
  'remember_login_cookie_lifetime' => 1296000,
  'mail_from_address' => 'noreply',
  'mail_domain' => 'SENSITIVE DATA',
  'mail_smtpauthtype' => 'LOGIN',
  'blacklisted_files' => 
  array (
    0 => '.DS_Store',
  ),
  'secret' => 'SENSITIVE DATA',
  'appstore.experimental.enabled' => true,
  'singleuser' => false,
  'mail_smtpport' => '465',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'SENSITIVE DATA',
  'mail_smtppassword' => 'SENSITIVE DATA',
  'mail_smtpsecure' => 'ssl',
  'updatechecker' => false,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'filelocking.enabled' => 'true',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '10.0.222.148',
    'port' => 6379,
    'timeout' => 0,
    'dbindex' => 0,
  ),
  'cron_log' => true,
  'overwrite.cli.url' => 'SENSITIVE DATA',
  'trusted_proxies' => 
  array (
    0 => '10.0.222.89',
    1 => '10.0.222.38',
  ),
);

Are you using external storage, if yes which one: NFS-Server

Are you using encryption: No

Are you using an external user-backend, if yes which one: No

Client configuration

Browser: Safari 11.0.3 for Mac OS Firefox 58.0.2 Google Chrome 64.0.3282.167

Operating system: MacOS and Win

Nextcloud log (data/nextcloud.log)

Nextcloud log No indication of the problem mentioned

Browser log

0c5f8c4546dc48be3e1bd55c5bd2fc4edbf0d479_1_690x268 711fd1942fcad4b594f01043682aa26385147ef7_1_690x458 83cc868c397c076453f822cef9638c2796b778d7_1_635x500

freumichCH avatar Feb 27 '18 10:02 freumichCH

We suspect that the new rate limiting (trottling) mechnism and Brute Force Protection (which is disabled) causes these delays.

This is the same ;)

The disabling Brute Force Protection in config.php have solved part of the problem.

Then you should properly setup your proxy server: https://docs.nextcloud.com/server/13/admin_manual/configuration_server/reverse_proxy_configuration.html

MorrisJobke avatar Feb 27 '18 10:02 MorrisJobke

Looks like the bruteforce protection. Please remove all content from oc_bruteforce_attempts to verify there is nothing left. and then Check the proxy config from above.

MorrisJobke avatar Feb 27 '18 10:02 MorrisJobke

There are no records in the oc_bruteforce_attempts.

Proxy Config will i check this night. May its good to know that the issue also happens when pointing direkt to the apache machine. Had a quick look in to redis Monitor and noticed that it goes really wild wile loading a page.

here a shot example:

1515345445.254258 [0 127.0.0.1:33904] "EXEC" 1515345445.254432 [0 127.0.0.1:33904] “INCRBY” “0a05783b24c9cb834dd7430c1a79ac24/lockfiles/d6aad4cbc3df439e322896aebdcb520e” "1" 1515345445.254507 [0 127.0.0.1:33904] “EXPIRE” “0a05783b24c9cb834dd7430c1a79ac24/lockfiles/d6aad4cbc3df439e322896aebdcb520e” "3600" 1515345445.255699 [0 127.0.0.1:33904] “WATCH” "0a05783b24c9cb834dd7430c1a79ac24/lockfiles/d6aad4cbc3df439e322896aebdcb520e" 1515345445.255807 [0 127.0.0.1:33904] “GET” "0a05783b24c9cb834dd7430c1a79ac24/lockfiles/d6aad4cbc3df439e322896aebdcb520e" 1515345445.255878 [0 127.0.0.1:33904] "MULTI" 1515345445.255999 [0 127.0.0.1:33904] “DEL” “0a05783b24c9cb834dd7430c1a79ac24/lockfiles/d6aad4cbc3df439e322896aebdcb520e”

We got millions of these Records from just loading one page.

freumichCH avatar Feb 27 '18 16:02 freumichCH

Same here ... very slow login when the solution is proxyfied, i have to disable web proxy of WAF to have connect time less than 4 sec ... this doesn't happend on nextcloud 12

If it's a new mechanism, why nextcloud log print nothing ?

ad1rie1 avatar Feb 27 '18 16:02 ad1rie1

If it's a new mechanism, why nextcloud log print nothing ?

This is logged in the info level (1): https://github.com/nextcloud/server/blob/5a270c271567d3c6ef9d0f1f78814b5b249ca2fe/lib/private/Security/Bruteforce/Throttler.php#L116

@ad1rie1 Sounds really like to be fixed with https://docs.nextcloud.com/server/13/admin_manual/configuration_server/reverse_proxy_configuration.html

MorrisJobke avatar Feb 27 '18 17:02 MorrisJobke

We got millions of these Records from just loading one page.

@icewind1991 @rullzer Ideas? Is this the SCSS stuff?

MorrisJobke avatar Feb 27 '18 17:02 MorrisJobke

could be. But I still have no clue why the redis sometimes goes crazy of the appdata. It sounds like it is performaing full scans but I don't get why...

rullzer avatar Feb 27 '18 20:02 rullzer

Reconfigure the reverse proxy has not change the situation. Additionaly we tried to run the instance with the original nextcloud theme who ends in the same results.

freumichCH avatar Feb 28 '18 10:02 freumichCH

@MorrisJobke Do you needed more infos from our side? This ticket has still the "needs Info" label.

freumichCH avatar Mar 01 '18 08:03 freumichCH

Nothing easy I can think of, but maybe you could do a little profile of the request that is slow to identify the bottleneck. I can recommend https://blackfire.io for profiling. It's quite easy once you set it up (agent, and the php extension) you only need to open the web dev tools in your browser, check for the long running request in the network tab, then do right click -> copy as curl and paste it to the command line like blackfire <CURL PASTE>

MorrisJobke avatar Mar 01 '18 08:03 MorrisJobke

Profiling with blackfire.io has not shown any relevant results. But we fount this Issue on Github who seams to be relevant to our: #https://github.com/nextcloud/server/issues/6459

The Solution of Rayn0r worked perfectly:

Today I deleted the contents of the preview folder and ran "occ files:scan-app-data". (I should have done this a lot earlier...)

We learned a lot from this issue and hope that can help other affected instance

Thanks to everyone who was involved in this disscousion.

@MorrisJobke Think we can close this issue 😊

freumichCH avatar Mar 12 '18 09:03 freumichCH