Mysql with very high CPU usage


At this moment, mysql is eating almost 300% of my CPU. Looking at the logs, there is no slow query. The general log shows several queries per second, and apparently they are all the same query:

SELECT fileid, storage, path, path_hash, parent, name, mimetype, mimepart, size, mtime, storage_mtime, encrypted, etag, permissions, checksum FROM oc_filecache WHERE storage = ‘30’ AND path_hash = ‘03da3222aedc508d8f137015f25773c9’

Looking at the oc_storages table, I found that 30 refers to
| home::carloslunna | 30 | 1 | NULL |

However, this user has only 2.3MB in its account. Apparently, he is not transfering a high amount of data.

As advised here [Solved] Very high cpu load on mysql after upgrade to nextcloud 10, I turned query_cache_type = on , but it didnt work. Reload php7.0-fpm solves for a while, but after 10 minutes it starts eating all CPU again.

any hints?

Nextcloud version (eg, 10.0.2):
Operating system and version (eg, Ubuntu 16.04): Debian Strech (9.2)
Apache or nginx version (eg, Apache 2.4.25): Apache 2
PHP version (eg, 5.6): 7.0
Is this the first time you’ve seen this error?: No

Can you reliably replicate it? (If so, please outline steps): Its happening now; dont know why it started

Remember, this information may be requested if it isn’t supplied; for fastest response please provide as much as you can :heart: Feel free to use a pastebin service, otherwise log files can be indented with 4 spaces on each line to present them in a friendlier way on the forum.

What does happen if you rescan this users files: sudo -u www-data php /path/to/nextcloud/occ files:scan username? Perhaps you can identify a corrupted file by adding -vvv to the occ command and see where it stucks.

Hi Michalng,

We found the file that was causing the problem, and asked the user to delete it.

Still dont know, however, the reason of this behaviour.


How did you found that file ?
With the occ -vvv command ?
What kind of file was it ?