nextcloud / server

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

External storage, high CPU load on NAS #12505

Closed lee-costa closed 4 years ago

lee-costa commented 5 years ago
### Steps to reproduce 1. Visit Nextcloud web gui 2. Watch load on NAS host 3. ### Expected behaviour Tell us what should happen No high CPU load if no activity on Nextcloud server ### Actual behaviour Tell us what happens instead smbd service causes NAS CPU spike to 90% ### Server configuration **Operating system**: Ubuntu 16.04 **Web server:** Server version: Apache/2.4.18 (Ubuntu) **Database:** **PHP version:** 7.0.32 **Nextcloud version:** (see Nextcloud admin page) 14.0.3 **Updated from an older Nextcloud/ownCloud or fresh install:** No **Where did you install Nextcloud from:** sudo wget https://download.nextcloud.com/server/releases/latest.zip **Signing status:**
Signing status ``` Login as admin user into your Nextcloud and access http://example.com/index.php/settings/integrity/failed paste the results here. ``` No errors have been found.
**List of activated apps:**
Accessibility 1.0.1 Official Activity 2.7.0 Official Collaborative tags 1.4.0 Official Comments 1.4.0 Official Deleted files 1.4.1 Official External storage support 1.5.0 Official Federation 1.4.0 Official File sharing 1.6.2 Official First run wizard 2.3.0 Official Gallery 18.1.0 Official Log Reader 2.0.0 Official Monitoring 1.4.0 Official Nextcloud announcements 1.3.0 Official Notifications 2.2.1 Official Password policy 1.4.0 Official PDF viewer 1.3.2 Official Share by mail 1.4.0 Official Support 1.0.0 Official Text editor 2.6.0 Official Theming 1.5.0 Official Update notification 1.4.1 Official Usage survey 1.2.0 Official Versions 1.7.1 Official Video player 1.3.0 Official Auditing / Logging 1.4.0 Official Default encryption module 2.2.0 Official External user support 0.4 Official LDAP user and group backend ``` If you have access to your command line run e.g.: sudo -u www-data php occ app:list from within your Nextcloud installation folder ``` Enabled: - accessibility: 1.0.1 - activity: 2.7.0 - cloud_federation_api: 0.0.1 - comments: 1.4.0 - dav: 1.6.0 - federatedfilesharing: 1.4.0 - federation: 1.4.0 - files: 1.9.0 - files_external: 1.5.0 - files_pdfviewer: 1.3.2 - files_sharing: 1.6.2 - files_texteditor: 2.6.0 - files_trashbin: 1.4.1 - files_versions: 1.7.1 - files_videoplayer: 1.3.0 - firstrunwizard: 2.3.0 - gallery: 18.1.0 - logreader: 2.0.0 - lookup_server_connector: 1.2.0 - nextcloud_announcements: 1.3.0 - notifications: 2.2.1 - oauth2: 1.2.1 - password_policy: 1.4.0 - provisioning_api: 1.4.0 - serverinfo: 1.4.0 - sharebymail: 1.4.0 - support: 1.0.0 - survey_client: 1.2.0 - systemtags: 1.4.0 - theming: 1.5.0 - twofactor_backupcodes: 1.3.1 - updatenotification: 1.4.1 - workflowengine: 1.4.0 Disabled: - admin_audit - encryption - user_external - user_ldap
**Nextcloud configuration:**
``` If you have access to your command line run e.g.: sudo -u www-data php occ config:list system from within your Nextcloud installation folder or Insert your config.php content here. Make sure to remove all sensitive content such as passwords. (e.g. database password, passwordsalt, secret, smtp password, …) ``` { "system": { "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "192.168.139.107" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "overwrite.cli.url": "http:\/\/192.168.139.107\/nextcloud", "dbtype": "mysql", "version": "14.0.3.0", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbport": "", "dbtableprefix": "oc_", "mysql.utf8mb4": true, "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true, "htaccess.RewriteBase": "\/nextcloud", "memcache.local": "\\OC\\Memcache\\APCu", "memcache.locking": "\\OC\\Memcache\\Redis", "trashbin_retention_obligation": "10, 15", "filelocking.enabled": "true", "redis": { "host": "***REMOVED SENSITIVE VALUE***", "port": 0, "timeout": 0 }, "maintenance": false, "theme": "", "loglevel": 2, "mail_smtpmode": "smtp", "mail_smtpauthtype": "LOGIN", "mail_smtpauth": 1, "mail_smtphost": "***REMOVED SENSITIVE VALUE***", "mail_smtpport": "465", "mail_domain": "***REMOVED SENSITIVE VALUE***", "mail_smtpsecure": "ssl", "mail_smtpname": "***REMOVED SENSITIVE VALUE***", "mail_smtppassword": "***REMOVED SENSITIVE VALUE***" } }
**Are you using external storage, if yes which one:** local/smb/sftp/... smb **Are you using encryption:** yes/no no **Are you using an external user-backend, if yes which one:** LDAP/ActiveDirectory/Webdav/... ``` With access to your command line run e.g.: sudo -u www-data php occ ldap:show-config from within your Nextcloud installation folder Without access to your command line download the data/owncloud.db to your local computer or access your SQL server remotely and run the select query: SELECT * FROM `oc_appconfig` WHERE `appid` = 'user_ldap'; Eventually replace sensitive data as the name/IP-address of your LDAP server or groups. ``` There are no commands defined in the "ldap" namespace. ### Client configuration **Browser:** Safari **Operating system:** OSX 10.14 ### Logs #### Web server error log
Web server error log ``` mkdir failed on directory /var/run/samba/msg.lock: Permission denied mkdir failed on directory /var/run/samba/msg.lock: Permission denied mkdir failed on directory /var/run/samba/msg.lock: Permission denied mkdir failed on directory /var/run/samba/msg.lock: Permission denied mkdir failed on directory /var/run/samba/msg.lock: Permission denied [Fri Nov 16 14:55:43.055736 2018] [autoindex:error] [pid 24294] [client 192.168.139.47:52040] AH01276: Cannot serve directory /var/www/html/nextcloud: No matching DirectoryIndex (none) found, and server-generated directory index forbidden by Options directive mkdir failed on directory /var/run/samba/msg.lock: Permission denied mkdir failed on directory /var/run/samba/msg.lock: Permission denied [Fri Nov 16 14:55:50.784808 2018] [authz_core:error] [pid 24295] [client 192.168.139.47:52041] AH01630: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata [Fri Nov 16 14:55:53.279263 2018] [authz_core:error] [pid 24295] [client 192.168.139.47:52041] AH01630: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata [Fri Nov 16 14:55:58.166070 2018] [authz_core:error] [pid 772] [client 192.168.139.47:52051] AH01630: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata [Fri Nov 16 15:08:10.675936 2018] [autoindex:error] [pid 24293] [client 192.168.139.47:52203] AH01276: Cannot serve directory /var/www/html/nextcloud: No matching DirectoryIndex (none) found, and server-generated directory index forbidden by Options directive mkdir failed on directory /var/run/samba/msg.lock: Permission denied [Fri Nov 16 15:08:17.030758 2018] [authz_core:error] [pid 772] [client 192.168.139.47:52209] AH01630: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata [Fri Nov 16 15:08:18.858868 2018] [authz_core:error] [pid 772] [client 192.168.139.47:52209] AH01630: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata [Fri Nov 16 15:08:20.715490 2018] [authz_core:error] [pid 772] [client 192.168.139.47:52209] AH01630: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata [Fri Nov 16 15:08:23.931355 2018] [authz_core:error] [pid 511] [client 192.168.139.47:52205] AH01630: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata [Fri Nov 16 15:11:04.382899 2018] [autoindex:error] [pid 24292] [client 192.168.139.47:52222] AH01276: Cannot serve directory /var/www/html/nextcloud: No matching DirectoryIndex (none) found, and server-generated directory index forbidden by Options directive mkdir failed on directory /var/run/samba/msg.lock: Permission denied mkdir failed on directory /var/run/samba/msg.lock: Permission denied mkdir failed on directory /var/run/samba/msg.lock: Permission denied mkdir failed on directory /var/run/samba/msg.lock: Permission denied mkdir failed on directory /var/run/samba/msg.lock: Permission denied mkdir failed on directory /var/run/samba/msg.lock: Permission denied mkdir failed on directory /var/run/samba/msg.lock: Permission denied mkdir failed on directory /var/run/samba/msg.lock: Permission denied mkdir failed on directory /var/run/samba/msg.lock: Permission denied [Fri Nov 16 15:12:02.754776 2018] [authz_core:error] [pid 688] [client 192.168.139.47:52247] AH01630: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata [Fri Nov 16 15:12:04.832045 2018] [authz_core:error] [pid 24293] [client 192.168.139.47:52246] AH01630: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata [Fri Nov 16 15:12:08.226555 2018] [authz_core:error] [pid 772] [client 192.168.139.47:52242] AH01630: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata [Fri Nov 16 15:12:14.785828 2018] [authz_core:error] [pid 24296] [client 192.168.139.47:52251] AH01630: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata mkdir failed on directory /var/run/samba/msg.lock: Permission denied [Fri Nov 16 15:16:14.562363 2018] [authz_core:error] [pid 1163] [client 192.168.139.47:52310] AH01630: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata [Fri Nov 16 15:16:16.381724 2018] [authz_core:error] [pid 24293] [client 192.168.139.47:52309] AH01630: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata [Fri Nov 16 15:16:21.214811 2018] [authz_core:error] [pid 24292] [client 192.168.139.47:52313] AH01630: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata mkdir failed on directory /var/run/samba/msg.lock: Permission denied [Fri Nov 16 15:23:25.771659 2018] [autoindex:error] [pid 24295] [client 192.168.139.47:52445] AH01276: Cannot serve directory /var/www/html/nextcloud: No matching DirectoryIndex (none) found, and server-generated directory index forbidden by Options directive mkdir failed on directory /var/run/samba/msg.lock: Permission denied [Fri Nov 16 15:23:47.801837 2018] [authz_core:error] [pid 459] [client 192.168.139.47:52455] AH01630: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata [Fri Nov 16 15:23:49.741028 2018] [authz_core:error] [pid 459] [client 192.168.139.47:52455] AH01630: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata ```
#### Nextcloud log (data/nextcloud.log)
Nextcloud log ``` Insert your Nextcloud log here ``` Empty
#### Browser log
Browser log ``` Insert your browser log here, this could for example include: a) The javascript console log b) The network log c) ... ```
This is my first time submitting a bug report so go easy on me :-) I am currently using external storage through SMB from my NAS device and recently, I noticed that Nexcloud will make my NAS host's CPU spike to nearly 80% while nothing is being written/read from Nextcloud. My monitoring tools will show activity between the NAS and Nextcloud with a high CPU usage on the NAS host. My first thought was some type of background tasks taking place but I monitored it for over 8 hours and it remained the same. Only a reboot of the Nextcloud host will stop the high load. It appears that it is triggered by logging in to Nextcloud using a web browser. Here's the TOP command on the Nextcloud server: https://imgur.com/SqnSk0P Here's my NAS host TOP: https://imgur.com/nZF1i8o As you can see, over 90% being used by the smbd service. Any ideas what could be wrong? I recently tried to get rid of some warnings on the Security & setup warnings page under settings and made some modifications to the configuration but nothing drastic. Only what was recommended to get rid of the warnings. It could be related to this? https://github.com/nextcloud/server/issues/6865
nextcloud-bot commented 5 years ago

GitMate.io thinks possibly related issues are https://github.com/nextcloud/server/issues/3789 (External storage), https://github.com/nextcloud/server/issues/4730 (Storage), https://github.com/nextcloud/server/issues/9042 (Use external storage CPU usage high), https://github.com/nextcloud/server/issues/8363 (enabling external storage), and https://github.com/nextcloud/server/issues/6865 (Extreme CPU load and slow operation with external storage SMB/CIFS).

lee-costa commented 5 years ago

To help document this issue, here's my monitoring graphs for when the issue begins:

CPU

screen shot 2018-11-24 at 8 04 43 am

Network

screen shot 2018-11-24 at 8 05 37 am

Disk

screen shot 2018-11-24 at 8 05 59 am

Note the spike shortly around 20:00.

After a restart of the Nextcloud server shortly after 09:00:

Network:

screen shot 2018-11-24 at 9 33 13 am

CPU

screen shot 2018-11-24 at 9 33 02 am

LunkSnee commented 5 years ago

Same - looks like I'll have to just not use SMB for now...

peacepenguin commented 5 years ago

These messages in the logs you posted seem bad: mkdir failed on directory /var/run/samba/msg.lock: Permission denied

Perhaps install samba-common package.

sudo apt install samba-common

Error seems related to this ubuntu bug: https://bugs.launchpad.net/ubuntu/+source/gvfs/+bug/1758653

kesselb commented 5 years ago

In addition you could try to install https://github.com/eduardok/libsmbclient-php. I would expect better performance from the native bindings.

peacepenguin commented 5 years ago

Looks like @kesselb pointed out a good fix for this. On another thread the fix to install libsmbclient-php was confirmed as fixing this issue. The Ubuntu package "php-smbclient" is the package name for the same github project referenced: "libsmbclient-php".

6865

https://github.com/nextcloud/server/issues/6865#issuecomment-466070327

Here's what fixed it for @LunkSnee over in the other thread:

apt install php-smbclient

skjnldsv commented 4 years ago

Yes, see usual smb recommendations for this :) Thanks for the help!