2

I keep getting an error of cURL error 28: Resolving timed out after 35xx milliseconds when certain updates are made to my feeds in GetStream.io (xx = different millisecond values). It seems like this must be coming from an error on GetStream's side that may not be reporting back correctly. Does anyone know if GetStream addActivity calls go over 3.5 seconds?

Since this is intermittent, the only thing I can think is that there may be a GetStream error regarding the foreign_id, as it may potentially be replicating an existing foreign_id. However, there is limited information on GetStream's usage of foreign_id's.

Here is my simplified code for the GetStream call:

//Add Activity to Feeds

    $ccFeeds = ["Event:1", "Game:2", "Character:5", "Region:6"];

    $client = new Client(env('GETSTREAM_API_KEY'), env('GETSTREAM_API_SECRET'));
    $feed = $client->feed('User', 3);

    $sendData = [
        'actor'      => 'User:3',
        'verb'       => 'update',
        'object'     => 'Image:4',
        'target'     => 'Character:5',
        'foreign_id' => 'Image:4',
        'to'         => $ccFeeds
    ];
    $feed->addActivity($sendData);



UPDATED: April 8, 2016 - More info on error
Here is more info on the error we receive:

ConnectException in CurlFactory.php line 186: cURL error 28: Resolving timed out after 3512 milliseconds (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

in CurlFactory.php line 186

at CurlFactory::createRejection(object(EasyHandle), array('errno' => '28', 'error' => 'Resolving timed out after 3512 milliseconds', 'url' => 'https://api.getstream.io/api/v1.0/feed/User/145636936490547870efa96b68a892ca/?api_key= null, 'http_code' => '0', 'header_size' => '0', 'request_size' => '0', 'filetime' => '-1', 'ssl_verify_result' => '0', 'redirect_count' => '0', 'total_time' => '3.512752', 'namelookup_time' => '0', 'connect_time' => '0', 'pretransfer_time' => '0', 'size_upload' => '0', 'size_download' => '0', 'speed_download' => '0', 'speed_upload' => '0', 'download_content_length' => '-1', 'upload_content_length' => '-1', 'starttransfer_time' => '0', 'redirect_time' => '0', 'redirect_url' => '', 'primary_ip' => '', 'certinfo' => array(), 'primary_port' => '0', 'local_ip' => '', 'local_port' => '0')) in CurlFactory.php line 150

at CurlFactory::finishError(object(CurlHandler), object(EasyHandle), object(CurlFactory)) in CurlFactory.php line 103

at CurlFactory::finish(object(CurlHandler), object(EasyHandle), object(CurlFactory)) in CurlHandler.php line 43

at CurlHandler->__invoke(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'timeout' => '3', 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in Proxy.php line 28 at Proxy::GuzzleHttp\Handler{closure}(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'timeout' => '3', 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in Proxy.php line 51

at Proxy::GuzzleHttp\Handler{closure}(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'timeout' => '3', 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in PrepareBodyMiddleware.php line 72

at PrepareBodyMiddleware->__invoke(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'timeout' => '3', 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in Middleware.php line 30

at Middleware::GuzzleHttp{closure}(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'timeout' => '3', 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in RedirectMiddleware.php line 68

at RedirectMiddleware->__invoke(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'timeout' => '3', 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in Middleware.php line 59

at Middleware::GuzzleHttp{closure}(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'timeout' => '3', 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in HandlerStack.php line 67

at HandlerStack->__invoke(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'timeout' => '3', 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in Client.php line 268

at Client->transfer(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'timeout' => '3', 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false, '_conditional' => array('User-Agent' => 'GuzzleHttp/6.1.1 curl/7.35.0 PHP/5.5.9-1ubuntu4.13'))) in Client.php line 98

at Client->sendAsync(object(Request), array('synchronous' => true)) in Client.php line 104

at Client->send(object(Request)) in Feed.php line 99

at Feed->makeHttpRequest('feed/User/145636936490547870efa96b68a892ca/', 'POST', array('actor' => 'User:145636936490547870efa96b68a892ca', 'verb' => 'update', 'object' => 'Image:1460097866182455b2966b0d6af6c6ca', 'target' => 'UserCharacter:14578366478445749c90d674fcbfcf7a', 'foreign_id' => 'Image:1460097866182455b2966b0d6af6c6ca1460097866', 'to' => array('UserCharacter:14578366478445749c90d674fcbfcf7a xIhp_AjtHawdcoxhOyVkM40-dnk', 'Character:14542764069160f34f6bba72eba8369a 0Z-xTykbo-wxNgPy0NAZts-mDgU', 'Universe:14578366478314e869bd6fdbe67cfb1a FZbzNGVTQhCwa0s7QNu2NbNGZpk', 'Genre:14504636484684adffda0df53e17a83a 07_msjt2sUDptVBstw4gq5ZtPfw')), null, 'feed', 'write') in BaseFeed.php line 152

at BaseFeed->addActivity(array('actor' => 'User:145636936490547870efa96b68a892ca', 'verb' => 'update', 'object' => 'Image:1460097866182455b2966b0d6af6c6ca', 'target' => 'UserCharacter:14578366478445749c90d674fcbfcf7a', 'foreign_id' => 'Image:1460097866182455b2966b0d6af6c6ca1460097866', 'to' => array('UserCharacter:14578366478445749c90d674fcbfcf7a', 'Character:14542764069160f34f6bba72eba8369a', 'Universe:14578366478314e869bd6fdbe67cfb1a', 'Genre:14504636484684adffda0df53e17a83a'))) in ImageSMLHandler.php line 146

at ImageHandler->processImages() in ImagesApiController.php line 55

severus
  • 103
  • 2
  • 11
  • Could you clarify if you're running this code in production or development? (the network could be triggering the timeout, especially if you're on your local wifi instead of a datacenter) – Thierry Apr 04 '16 at 22:23
  • Hi Thierry, my apologies, I missed your comment. The issue was actually due to Laravel inconsistently confusing Guzzle\Http\Client with GetStream\Stream\Client. Setting the alias seems to have solved the issue. – severus Apr 06 '16 at 00:16
  • @Thierry, so my theory was wrong. I'm still getting the error. It seems to happen if we have not sent a Feed addActivity call in a while. I'm updating my original post to include more information from the error message we receive. In terms of your question about the location, this is running on a production server at DigitalOcean. I would love any help you may have to offer. – severus Apr 08 '16 at 07:06
  • At the moment the 99th percentile for adding activities is 30ms. This seems like a network issue. From where are you making the request? – Thierry Apr 04 '16 at 22:25
  • Thank you for the quick reply! I'm making the request from our dev server on DigitalOcean. It's running Laravel 5.1 on a Ubuntu LEMP stack with 512MB RAM. We have only a few programmers accessing the server, and our graphs show that we're using less 1MB per second bandwidth, at 5% CPU load. – severus Apr 05 '16 at 01:11
  • Hi Theirry, after more investigation, I found that this was actually caused by an issue where Laravel was inconsistently using the Guzzle\Client instead of GetStream\Stream\Client. I set the alias 'Client' => 'GetStream\Stream\Client' in my config/app.php file, and that seems to have solved the issue. It's good to know that GetStream is so responsive in terms of troubleshooting and server response. I very much appreciate the GetStream service, thank you. – severus Apr 06 '16 at 00:11

1 Answers1

1

I found that this was actually caused by an issue where Laravel was inconsistently using the \Guzzle\Http\Client instead of GetStream\Stream\Client, even though

use GetStream\Stream\Client;

was defined at the top of the FeedClass I set up. I set the alias in config/app.php to

'Client' => 'GetStream\Stream\Client'

and that seems to have solved the issue.

severus
  • 103
  • 2
  • 11