fennb/phirehose

TCP failures on production server

Closed this issue · 3 comments

I can get Phirehose to run fine in my development server but cannot get it to run on the production servers. Is there something special that I need to have on the server to get it to work?
My production server is configured using http://forge.laravel.com with the php info available on http://neon.19degrees.io

The production server uses a similar vagrant image as http://laravel.com/docs/4.2/homestead (nginx + php5.6).

The following are the errors I am getting in the production log... it go on till the 21 retries and give up.

Phirehose: Connecting to twitter stream: https://stream.twitter.com/1.1/statuses/filter.json with params: array ( 'track' => '19degreesdevtest',)
Phirehose: Resolved host stream.twitter.com to 199.59.148.138
Phirehose: Connecting to ssl://199.59.148.138, port=443, connectTimeout=5
Phirehose: TCP failure 1 of 20 connecting to stream: (0). Sleeping for 1 seconds.
Phirehose: Connecting to twitter stream: https://stream.twitter.com/1.1/statuses/filter.json with params: array ( 'track' => '19degreesdevtest',)
Phirehose: Resolved host stream.twitter.com to 199.59.148.138
Phirehose: Connecting to ssl://199.59.148.138, port=443, connectTimeout=5
Phirehose: TCP failure 2 of 20 connecting to stream: (0). Sleeping for 2 seconds.
Phirehose: Connecting to twitter stream: https://stream.twitter.com/1.1/statuses/filter.json with params: array ( 'track' => '19degreesdevtest',)
Phirehose: Resolved host stream.twitter.com to 199.59.148.138
Phirehose: Connecting to ssl://199.59.148.138, port=443, connectTimeout=5
Phirehose: TCP failure 3 of 20 connecting to stream: (0). Sleeping for 4 seconds.
Phirehose: Connecting to twitter stream: https://stream.twitter.com/1.1/statuses/filter.json with params: array ( 'track' => '19degreesdevtest',)
Phirehose: Resolved host stream.twitter.com to 199.59.148.138
Phirehose: Connecting to ssl://199.59.148.138, port=443, connectTimeout=5
Phirehose: TCP failure 4 of 20 connecting to stream: (0). Sleeping for 8 seconds.

it seems that for some reason the server doesn't like the resolved stream.twitter.com ip

in https://github.com/fennb/phirehose/blob/master/lib/Phirehose.php#L649
if i updated the code from

@$this->conn = fsockopen($scheme . $streamIP, $port, $errNo, $errStr, $this->connectTimeout);

to

@$this->conn = fsockopen("ssl://stream.twitter.com", $port, $errNo, $errStr, $this->connectTimeout);

it works

seems to be php5.6 related: #69

Please be sure you are running at least 5.6.9, there are known issues with PHP 5.6.8.