Timeout issue when running "Diagnostics - System Check"

Hello,

I have been experiencing a timeout issue on my Matomo installation when running the “Diagnostics - System Check” after 60 seconds, even though I have set max_execution_time and max_input_time to -1. I have checked and confirmed that my PHP-FPM is working properly.

My current PHP configuration values are: (also tested these on web)
max_execution_time : -1
max_input_time : -1
memory_limit : 512M
post_max_size : 8M
upload_max_filesize : 2M
max_file_uploads : 20
max_input_vars : 1000
max_input_nesting_level : 64

I am using the latest Matomo Docker image and I have tried to troubleshoot the issue but have been unable to find the root cause. I would greatly appreciate any help in resolving this issue.

I am using Matomo version 4.13.1 and my server setup is:

  • PHP version: 8.1.14
  • MySQL version: 10.10.2
  • CPU: 1 core
  • RAM: 2 GB

If you need any additional information, please let me know.

Thank you in advance for your help.

This could be caused by cURL or file access which is timing out because of firewall rules or other components that block those requests. You could try to disable internet features; Matomo will not try to do external requests (or requests to itself) after that and probably won’t time out:

config.ini.php, section [General]:
enable_internet_features = 0

If the system check is working while internet features are disabled, you’ll have to find the root cause (cURL or file system access) and fix it (firewall / disabling some of the system checks).

For example - disabling FileIntegrity and ForceSSL check, you can create a file “config.php” in the config folder of Matomo and inject the following code:

<?php

return [
    'diagnostics.disabled' => [
        DI\get('Piwik\Plugins\Diagnostics\Diagnostic\FileIntegrityCheck'),
	DI\get('Piwik\Plugins\Diagnostics\Diagnostic\ForceSSLCheck')
    ]
];

The problem persists when I set enable_internet_features to false or disable ForceSSLCheck.

But only when I disable FileIntegrityCheck the problem goes away. Let’s not forget that I’ve been using Matomo for two years and this is the first time I’ve had these problems. Is there a way I can inspect the errors of the FileIntegrityCheck function?

I’m not sure, what could be the root cause of this. Perhaps something related to docker. Do you have any errors in your logfiles concerning file system access / permissions, etc.?

Maybe connected to Throwing warnings with PHP 8.2 and Matomo 4.13.1 - where the is_dir function seems to be the cause. This operation can take some time on slow storage. Do you by chance use a network drive for the Matomo files / docker container?

Do you by chance use a network drive for the Matomo files / docker container?

My matomo instance runs behind VPS. For testing purpose I copied to my local -real- machine. My local machine has 4 core intel i5 cpu and 8GB ram, now I didn’t have the same error but the request was only able to complete after 23 seconds and CPU usage on both cores reached 100% during the request.

I guess the request cannot be completed on the server due to lack of CPU. But I couldn’t understand the relevance of this to being terminated after 60 seconds.

I gues solved the issue, i checked number of files under tmp/cache/tracker and it says:

$ ls -1 ./tmp/cache/tracker/ | wc -l
222411

In my local I deleted ./tmp/cache/tracker/ and problem is solved. Request completed after 3 seconds.

Is it safe to delete some ./tmp/cache/tracker/ files on production instance?

edit: It seems that Matomo created a whopping 200,000 zero length files in there and I am going to delete swapXXXXXX files.