Aws-sdk-php: SqsException: with message 'Error executing "ReceiveMessage" SSL: crypto enabling timeout

Created on 22 Sep 2016  Â·  14Comments  Â·  Source: aws/aws-sdk-php

Hello, I used 10 sqs to send email marketing, we are experiencing this error with SQS:

exception 'Aws\Sqs\Exception\SqsException' with message 'Error executing "ReceiveMessage" on "https://sqs.ap-southeast-1.amazonaws.com/xxxxx/x_7"; AWS HTTP error: Error creating resource: [message] fopen(): SSL: crypto enabling timeout [file] /var/www/html/jhmail/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php [line] 287 [message] fopen(): Failed to enable crypto [file] /var/www/html/jhmail/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php [line] 287 [message] fopen(https://sqs.ap-southeast-1.amazonaws.com/xxxxx/emails_7): failed to open stream: operation failed [file] /var/www/html/jhmail/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php [line] 287'
This error seems to happen randomly 2-3 times per day, and on randomly queue.

I'm using "aws/aws-sdk-php-laravel": "~3.0".

Any idea what could be causing this?
thank you!

guidance

Most helpful comment

This is also happening to me once every week.

Error executing "ReceiveMessage" on "https://sqs.us-east-1.amazonaws.com/xxx/jobs_status"; AWS HTTP error: Error creating resource: [message] fopen(https://sqs.us-east-1.amazonaws.com/xxx/jobs_status): failed to open stream: HTTP request failed! [file] /site/aws/GuzzleHttp/Handler/StreamHandler.php [line] 323

All 14 comments

@coderlazy Thanks for the information! Since it happens randomly, would it be possible for you to catch some wire log information (debug option could be configured to have more helpful information) here to see what might go wrong with it? It would also be helpful if you could provide some code snippets that might help me to reproduce the issue.

Meanwhile, for general SSL problem, could you double check that your CA bundle is configured correctly? Also, http configuration could be tuned, for example, you can customize the peer SSL/TLS certificate verification using verify http option as well.

Thank you for reply,
and here is code i using to send mail (i using Laravel):

  1. I add command send mail to queue

    foreach ($customer_list as $customer) {

    /* create an email here*/

    //add command send mail to queue from 1 to 10

    if ($count_queue == 10) {

    $count_queue = 0;

    }

    if ($count_queue == 0) {

    try {

    $q = Queue::pushOn(QUEUE_EMAIL, new \App\Jobs\SendEmailSes($customer->email, [], $email->title, $body, $idc, $customer->id, $email->id, $key_message), '');

    } catch (Exception $ex) {

    debugLog('ex: ' . $ex);

    }

    } else {

    try {

    $q = Queue::pushOn(QUEUE_EMAIL . '_' . $count_queue, new \App\Jobs\SendEmailSes($customer->email, [], $email->title, $body, $idc, $customer->id, $email->id, $key_message), '');

    } catch (Exception $ex) {

    debugLog('ex: ' . $ex);

    }

    }

    $count_queue += 1;

    }

    2.Queue config

    'sqs' => [

    'driver' => 'sqs',

    'key' => env('AWS_ACCESS_KEY_ID'),

    'secret' => env('AWS_SECRET_ACCESS_KEY'),

    'queue' => 'https://sqs.ap-southeast-1.amazonaws.com/xxx/xxx',

    'region' => 'ap-southeast-1',

    ],

    3. I using Supervisor to run queue
    you can see in here.

Thank you.

@coderlazy Quick question, which Ses or Sqs API in PHP SDK are you using? I didn't see any SendEmailSes or pushOn there, are you suggesting SendEmail?

Closing due to ages, yet feel to reopen with further comments, details or questions :)

I am also getting this error, not sure what is causing it. And most of the time it would work, I am just worried if it might be silently failing in some cases, which I am not getting information of. I am also using Laravel

aws/aws-sdk-php 3.20.12

exception 'AwsSqs\ExceptionSqsException' with message 'Error executing "ReceiveMessage" on "https://sqs.ap-southeast-1.amazonaws.com/***/default"; AWS HTTP error: Error creating resource: [message] fopen(): SSL: crypto enabling timeout
[file] /var/www/nrgedge/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
[line] 312
[message] fopen(): Failed to enable crypto
[file] /var/www/nrgedge/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
[line] 312

Same. Happens really infrequently. Here is mine:

Aws\Sqs\Exception\SqsException · Error executing "ReceiveMessage" on "https://sqs.us-west-2.amazonaws.com/***/***"; AWS HTTP error: cURL error 6: Could not resolve host: sqs.us-west-2.amazonaws.com (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

Getting somehow same problem randomly.

executing "CreateQueue" on "https://sqs.ap-south-1.amazonaws.com"; AWS HTTP error: Error creating resource: [message] fopen(): SSL: Handshake timed out
[file] /var/www/html/gearman/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
[line] 323
[message] fopen(): Failed to enable crypto
[file] /var/www/html/gearman/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
[line] 323
[message] fopen(https://sqs.ap-south-1.amazonaws.com): failed to open stream: operation failed
[file] /var/www/html/gearman/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
[line] 323

The same random error happens here, this time with EC2 "DescribeTags"

Error executing "DescribeTags" on "https://ec2.eu-west-1.amazonaws.com"; AWS HTTP error: Error creating resource: [message] fopen(): SSL: Handshake timed out [file] C:\Users\Public\PHPScripts\clases\3rdparty\aws-php-sdk\vendor\guzzlehttp\guzzle\src\Handler\StreamHandler.php [line] 323 [message] fopen(): Failed to enable crypto [file] C:\Users\Public\PHPScripts\clases\3rdparty\aws-php-sdk\vendor\guzzlehttp\guzzle\src\Handler\StreamHandler.php [line] 323 [message] fopen(https://ec2.eu-west-1.amazonaws.com): failed to open stream: operation failed [file] C:\Users\Public\PHPScripts\clases\3rdparty\aws-php-sdk\vendor\guzzlehttp\guzzle\src\Handler\StreamHandler.php [line] 323

This is also happening to me once every week.

Error executing "ReceiveMessage" on "https://sqs.us-east-1.amazonaws.com/xxx/jobs_status"; AWS HTTP error: Error creating resource: [message] fopen(https://sqs.us-east-1.amazonaws.com/xxx/jobs_status): failed to open stream: HTTP request failed! [file] /site/aws/GuzzleHttp/Handler/StreamHandler.php [line] 323

This is also happening to me once every week.

Error executing "ReceiveMessage" on "https://sqs.us-east-1.amazonaws.com/xxx/jobs_status"; AWS HTTP error: Error creating resource: [message] fopen(https://sqs.us-east-1.amazonaws.com/xxx/jobs_status): failed to open stream: HTTP request failed! [file] /site/aws/GuzzleHttp/Handler/StreamHandler.php [line] 323

Did you find a solution for this issue? We are having the same issue? We looked at AWS SDK, OpenSSL and Curl but not able to resolve it..

Same, seems to happen on Get, Receive, and Delete.

Hi,
I am also getting same issue and using aws/aws-sdk-php-laravel": "^3.3"
"AWS HTTP error: Error creating resource: [message] fopen(): SSL: Handshake timed out [file]"
Can you please give some inputs to fix this issue?

This is also happening to me once every week.
Error executing "ReceiveMessage" on "https://sqs.us-east-1.amazonaws.com/xxx/jobs_status"; AWS HTTP error: Error creating resource: [message] fopen(https://sqs.us-east-1.amazonaws.com/xxx/jobs_status): failed to open stream: HTTP request failed! [file] /site/aws/GuzzleHttp/Handler/StreamHandler.php [line] 323

Did you find a solution for this issue? We are having the same issue? We looked at AWS SDK, OpenSSL and Curl but not able to resolve it..

I never found any solution to this and this is still happening. I simply catch and retry and it usually works. I think these are unavoidable AWS temporary network issues.

Whether to use Supervisor, please check the configuration file,
this is path: /etc/supervisor/conf.d/laravel-worker.conf

Was this page helpful?
0 / 5 - 0 ratings