Skip to content
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

matomo.php returns HTTP 200 when unable to connect to redis #97

Open
toredash opened this issue Feb 13, 2019 · 1 comment
Open

matomo.php returns HTTP 200 when unable to connect to redis #97

toredash opened this issue Feb 13, 2019 · 1 comment

Comments

@toredash
Copy link
Contributor

If matomo is configured to use QueuedTracking with Redis as backend, and matomo.php is unable to connect to such Redis instance, HTTP 200 is returned.

I would expect matomo.php return !200. For monitoring the availability of the tracker API, it makes it harder to validate that the Tracker API is healthy.

The error msg that is returned:

<br />
<b>Warning</b>:  Redis::connect(): connect() failed: Cannot assign requested address in <b>/var/www/html/vendor/piwik/cache/src/Backend/Factory.php</b> on line <b>60</b><br />
<br />
<b>Fatal error</b>:  Uncaught RedisException: Redis server went away in /var/www/html/vendor/piwik/cache/src/Backend/Factory.php:70
Stack trace:
#0 /var/www/html/vendor/piwik/cache/src/Backend/Factory.php(70): Redis-&gt;select(0)
#1 /var/www/html/vendor/piwik/cache/src/Backend/Factory.php(108): Piwik\Cache\Backend\Factory-&gt;buildRedisCache(Array)
#2 /var/www/html/core/Cache.php(75): Piwik\Cache\Backend\Factory-&gt;buildBackend('redis', Array)
#3 /var/www/html/config/global.php(67): Piwik\Cache::buildBackend('redis')
#4 [internal function]: DI\Definition\Source\DefinitionFile-&gt;{closure}(Object(DI\Container))
#5 /var/www/html/vendor/php-di/invoker/src/Invoker.php(82): call_user_func_array(Object(Closure), Array)
#6 /var/www/html/vendor/php-di/php-di/src/DI/Definition/Resolver/FactoryResolver.php(81): Invoker\Invoker-&gt;call(Object(Closure), Array)
#7 /var/www/html/vendor/php-di/php-di/src/DI/Definition/Resolver/ResolverDispatcher.php(58): DI\Definition\Resolver\FactoryResolver-&gt;resolve(Object(DI\Definition\FactoryDefinition), Array)
#8 /var in <b>/var/www/html/vendor/piwik/cache/src/Backend/Factory.php</b> on line <b>70</b><br />```

Headers returned:
```Request URL: X/matomo.php
Request Method: GET
Status Code: 200 ```
@tsteur tsteur transferred this issue from matomo-org/matomo Feb 13, 2019
@tsteur
Copy link
Member

tsteur commented May 7, 2019

Would require a bit of work here: https://github.com/matomo-org/plugin-QueuedTracking/blob/3.3.5/Queue/Manager.php#L153 to count the number of errors across all requests (we wouldn't stop all requests but only throw an exception at the end of the method if any failed).

Would also need to return the success value here: https://github.com/matomo-org/plugin-QueuedTracking/blob/3.3.5/Queue.php#L75 and would also need to return success/failure status in the MySQL and Redis backend in the appendValuesToList() method.

It may not all be hard to develop but creating tests for all this is the time consuming part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants