Excessive CPU usage ownCloud 2.2.1
Expected behaviour
When I change one file, ownCloud should synchronise that file. CPU usage should stay low.
Actual behaviour
When I change one file, ownCloud starts to scan the sync folder and uses 100% of CPU for about some seconds. If you changed another file in the meantime it rescans right away and stays at 100% CPU for minutes. This is annoying if you keep editing files (which is not uncommon).
This did not happen in older clients (at least they were not keeping the CPU at 100% all the time).
Steps to reproduce
- Start OwnCloud client
- Edit a file in the sync folder
Server configuration
Operating system: Ubuntu 14.04
Web server: Apache
Database: MySQL
PHP version: 5.6
ownCloud version: 8.2.5
Storage backend: Files
Client configuration
Client version: 2.2.1
Operating system: (L)Ubuntu 14.04
OS language: DE
Installation path of client: /usr/bin/owncloud
Logs
- Output of
owncloud
06-15 13:44:26:513 0x22e2460 detected changes in paths: QSet("/folder/xxx.myfile")
06-15 13:44:26:513 0x22e2460 Schedule folder "ownCloud" to sync!
06-15 13:44:26:514 0x22e2460 Sync state changed for folder "https://url.xx/remote.php/webdav/" : "Not yet Started"
06-15 13:44:26:514 0x22e2460 void OCC::ServerNotificationHandler::slotFetchNotifications(OCC::AccountState*) Account "[email protected]" does not have notifications enabled.
06-15 13:44:26:514 0x22e2460 Scheduling a sync in 2 seconds
[...]
06-15 13:44:39:859 0x22e2460 No database Transaction to commit
06-15 13:44:39:878 0x22e2460 CSync run took 11355
- Web server error log: No errors
- ownCloud log (data/owncloud.log): No problem here
@jabdoa2 This is interesting. We always rescan all paths if a single file changes and on startup, this is nothing that changed over the different versions.
How many files/folders do you have? It should not be at 100% for minutes, maybe for some seconds?
Maybe it did it less efficient/less often before? As you see in the log it takes about 13s for one run. On this machine some folders are excluded. I got about 62k files to synchronise:
$ find | wc -l
62025
Since most IDEs autosave changes its not uncommon to always have a changed file in the folder which leads to the behaviour from above.
If you don't enable any logging flags (which is also slowing down the sync), most of the time during the discovery is spent in analysing the exclude list.
We indeed added a few entries to the exclude list.
I always disabled the exclusion list in the client (because i want to synchronise dot files for example). As long as there are no hidden exclusions, it should be empty. System runs on a SSD and an i7 (mobile 2 cores + HT).
I noticed the issue because the fan of my notebook started to run permanently when I use my IDE to edit stuff. This did not happen before. Also it only happens when I edit stuff. Average system load is at about 2 and its mostly caused by the ownCloud client (it takes 2 out of 4 HT cores).
Windows 10 x64 - OwnCloud Client 2.2.1
I'm seeing similar behaviour, OwnCloud is regularly taking several minutes scanning and consuming ~18% CPU (Gen 6 i7), even when no files have changed. Once the scan is completed, it seems to wait for about ~30 seconds and then repeats the scan.
Our company uses OwnCloud for filesharing between clients and we have a few hundred folders in total. This is problematic for laptop users like myself for example, where constant background CPU drains battery very quickly.
OS X 10.11.5 ownCloud Client 2.2.1 ownCloud 8.2.5
Excessive CPU usage as well while scanning my sync folders for changes. The process is running at 100% CPU load on one core then. Hidden files won't sync.
You can see the high CPU usage twice in this graph (every time, ownCloud is looking for changes):

I can also confirm that ownCloud almost constantly eats a whole CPU core here on Windows 7, and with a dual-core setup things get sluggish very quickly if some other application also does some CPU-intensive work. If you're not already doing so, the scan thread should probably work at one of the lowest possible thread priorities. Manually changing the entire process priority via Task Manager to something lower than default seems to make Windows more responsive again, so I guess that the client might not reduce the thread priority at the moment.
@sagamusix @patrickhafner @Instinct64 Do you guys think the previous client versions were better in this regard?
I've reverted to 2.1.1 in order to test this. I see that OwnCloud only ramps up it's CPU usage for a few seconds, rather than the near continuous ~20% usage I see on my machine with 2.2.1.
Same issue as @Instinct64, client is using 100% of one core, stops a few minutes, then using 100% again...
@Instinct64 @FlorentCoppint do you use overlay icons in a file manager?
@dragotin Owncloud applies it's own overlay icons in Windows Explorer. I dont have any other apps applying overlay icons in the Owncloud folders.
@dragotin I'm on Ubuntu 16.04 and I don't see any overlay icons of owncloud. Some time ago, I did.
About the syncs happening permanentely in a loop:
Please run the client with logfile, e.g. owncloud --logfile - on Linux or /Applications/owncloud.app/Contents/MacOS/owncloud --logfile - on OS X.
That way you should see what triggers the "next sync". Please provide us with this information.
About 2.2.1 using more CPU than 2.1.2:
if you trim down (exit the client, copy the file to a backup, remove a few of the exotic entries) the exclude list in sync-exclude.lst does it still produce so much CPU load?
To your first question: It just another changed file in the meantime. The client got very aggressive to scan. Maybe it was just slower previously? To your second question: I got an empty sync-exclude.lst. So yes it also appears.
@guruz
@sagamusix @patrickhafner @Instinct64 Do you guys think the previous client versions were better in this regard?
Yep, because my fans were noiseless during sync until i installed the 2.2.1 update of the client. Now I can hear, when ownCloud is syncing my files :-D
Way better with 2.1.1 than 2.2.1. CPU usage back to normal with 2.1.1
I did some profiling and see significantly more time spent in csync_excluded_* in 2.2 (47% of stack traces) vs in 2.1 (15%) in my test case. I'll investigate whether that's only due to the additions to the ignore file or for other reasons.
Edit: No, seems to be unrelated to the two new entries.
Edit:
2.1 / 2.2 frame
84 / 159 DiscoveryJob::start
39 / 80 csync_walker and _detect_update
29 / 65 csync_statedb_get_below_path
35 / 111 csync_excluded_traversal
(inflow: 15 from update, 20 from statedb / 57 from update, 54 from statedb)
So, the discovery jobs pop up significantly more often, mainly due to slower csync_excluded_traversal calls?
@jabdoa2 Could you please verify your sync log if you really have an empty exclude list? You should not see something like this:
06-02 18:09:55:829 186297 OCC::Folder::setIgnoredFiles: ==== adding system ignore list to csync: "/Users/guruz/woboq/owncloud/client/buildmirall/bin/owncloud.app/Contents/Resources/sync-exclude.lst"
06-02 18:09:55:829 0x105536b80 csync_exclude_load: Adding entry: *~
06-02 18:09:55:829 0x105536b80 csync_exclude_load: Adding entry: ~$*
06-02 18:09:55:829 0x105536b80 csync_exclude_load: Adding entry: .~lock.*
06-02 18:09:55:829 0x105536b80 csync_exclude_load: Adding entry: ~*.tmp
06-02 18:09:55:829 0x105536b80 csync_exclude_load: Adding entry: ]*.~*
*6-02 18:09:55:829 0x105536b80 csync_exclude_load: Adding entry: ]Icon
06-02 18:09:55:829 0x105536b80 csync_exclude_load: Adding entry: ].DS_Store
06-02 18:09:55:829 0x105536b80 csync_exclude_load: Adding entry: ].ds_store
06-02 18:09:55:829 0x105536b80 csync_exclude_load: Adding entry: ._*
06-02 18:09:55:829 0x105536b80 csync_exclude_load: Adding entry: ]Thumbs.db
06-02 18:09:55:829 0x105536b80 csync_exclude_load: Adding entry: desktop.ini
...
@guruz looks like this:
06-20 14:04:34:096 0x268b460 ==== adding system ignore list to csync: "/etc/ownCloud/sync-exclude.lst"
06-20 14:04:34:096 0x268b460 ==== adding user defined ignore list to csync: "/home/xxx/.local/share/data/ownCloud/sync-exclude.lst"
06-20 14:04:34:096 0x268b460 Adding folder to Folder Map OCC::Folder(0x2a7b9b0) "ownCloud"
06-20 14:04:34:096 0x268b460 (+) Watcher: "/home/xxx/cloud/"
06-20 14:04:35:125 0x268b460 `-> and 8644 subdirectories