ably / ably-php

PHP client library SDK for Ably realtime messaging service
https://ably.com/download
Apache License 2.0
50 stars 10 forks source link

Fallback not being used with SSL timeouts #85

Closed tomczoink closed 2 years ago

tomczoink commented 4 years ago

We've had a report from a customer that when publishing, they'll sometimes see Ably\Exceptions\AblyRequestException cURL error: SSL connection timeout and try to use the fallback host.

MatthewHallCom commented 4 years ago

👋 This is us! We're seeing this with our Broadcaster for Laravel package that extends ably-php https://github.com/springboardVR/Laravel-Ably-Broadcaster

It looks like it mostly is happening when we're doing $ablyChannel->publish($event, $payload); multiple times very quickly. Happening between 50 to 100 times per day for us.

SimonWoolf commented 4 years ago

Fallback not being used with SSL timeouts #85

and try to use the fallback host.

To clarify, the task here to to check whether or not that error is triggering a fallback to be used. It should be, but the fact that a customer is seeing the error is evidence that it might not be (as it's unlikely that all fallbacks tried would all give an ssl timeout), so we don't currently know whether it is or not.

jdavid commented 4 years ago

There're a number of unit tests regarding fallback hosts, for instance: https://github.com/ably/ably-php/blob/master/tests/AblyRestTest.php#L185 https://travis-ci.org/ably/ably-php/jobs/621057124#L290

That error can only be produced in https://github.com/ably/ably-php/blob/master/src/Http.php#L161 It's the only place the error string cURL error: is used. There we set the 50003 error code. We try fallback hosts in this case, only error codes below 50000 are thrown immediately, see https://github.com/ably/ably-php/blob/master/src/AblyRest.php#L273 (this is verified in the unit test above).

With log level set to error you should see a message for every failed attempt. The default is warning, so you should see them.

By default fallbacks will be used, you can verify the list of fallback hosts with:

$ably = new AblyRest( $opts );
print_r( $ably->options->fallbackHosts );
mattheworiordan commented 4 years ago

@matthewhall-ca any chance you can share some of the logs when this happens?

MatthewHallCom commented 4 years ago

@matthewhall-ca any chance you can share some of the logs when this happens?

It hasn't happened in a while! Will let you know when it does

sacOO7 commented 2 years ago

Improve error logging via #119