-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught RuntimeException when Matomo host DNS couldn't resolve #105
Comments
That actually happens here: matomo-php-tracker/MatomoTracker.php Lines 1801 to 1814 in 9c2ff78
Maybe adding a retry after a small sleep might make sense. If you are familiar with PHP, feel free to create a PR for that. |
I'm a bit disappointed to see that this issue - which still causes a lot of PHP errors when connectivity to DNS servers is bad - was added but then removed from the current sprint milestone. Any chance of something happening soon? Alternatively, an option or parameter to pass in the IP address would also help. In my case - and I'm sure I'm not alone here - the matomo instance is on the same server as the websites being monitored, on an own subdomain. So the IP will always be that of the local host. That would save having to make a DNS call at all. |
If matomo runs on the same host, can't you simply use localhost for sending tracking requests? That one shouldn't need a dns to resolve. |
Re using localhost: I don't think that will work easily in my case. It's a VPS with one IP for all the websites, so it's using virtual hosts. Looking at protected function getBaseUrl() it takes the URL provided and appends '/matomo.php'. So the URL will be something like: https://m.example.com/matomo.php In order to reach that URL, the name of the virtual host is needed. If I just put in localhost or 127.0.0.1 then I would get the default website for the IP. I'm using Plesk so I could in fact select the matomo Vhost to be the default site - but then I would also need to put an SSL certificate for it in the administrators repository. All doable, but not exactly convenient. |
Well that was not so simple - when I go to the IP via SSL, then I need a cert for the IP (not the vhost). That should be possible somehow, but it's not a frequent thing. So I tried to use HTTP - but damn Plesk always redirects HTTP requests to the IP to HTTPS - grr... What I could do would be to call the matomo php file directly (Matomo, not MatomoTracker) - it happens to have the same uid/gid and is under the Webroot, being a subdomain. If not use open_basedir, no problem there. So my new question is: Is there a way to call matomo directly in PHP and pass all the parameters which are usually in the URL as GET-Parameters? Or even a matomo-daemon providing a socket - that would be really cool! |
Sometimes there's a problem with DNS and an address cannot be resolved. Then sadly, the tracker crashes out:
[11-Aug-2022 00:17:31 Europe/Berlin] PHP Fatal error: Uncaught RuntimeException: Could not resolve host: m.biblische-re
isen.de in /var/www/vhosts/biblische-reisen.de/biblical-tours.com/MatomoTracker.php:1761
Stack trace:
#0 /var/www/vhosts/biblische-reisen.de/biblical-tours.com/MatomoTracker.php(644): MatomoTracker->sendRequest()
#1 /var/www/vhosts/biblische-reisen.de/biblical-tours.com/config/analytics-body.php.inc(22): MatomoTracker->doTrackPageV
iew()
#2 /var/www/vhosts/biblische-reisen.de/biblical-tours.com/include/prototype/tail.php.inc(251): include('/var/www/vhosts.
..')
#3 /var/www/vhosts/biblische-reisen.de/biblical-tours.com/index.php(61): include('/var/www/vhosts...')
#4 {main}
thrown in /var/www/vhosts/biblische-reisen.de/biblical-tours.com/MatomoTracker.php on line 1761
The adress resolves normally except when there's a problem with connectivity to DNS-Servers. Would be great if this could be caught and maybe retried a couple of times.
Thanks for the great work, the tracker is just what I needed!
The text was updated successfully, but these errors were encountered: