searain
searain

Reputation: 3301

Google Cloud Client Library - load local file to cloud storage - cURL error 56:

I am using php Google Cloud Client library.

$bucket = $this->storage->bucket($bucketName);

    $object = $bucket->upload(
        fopen($localFilePath, 'r'),
        $options
    );

This statement, sometimes gave the following errors.


production.ERROR: cURL error 56: SSL read: error:00000000:lib(0):func(0):reason(0), errno 104 (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) {"exception":"[object] (Google\Cloud\Exception\ServiceException(code: 0): cURL error 56: SSL read: error:00000000:lib(0):func(0):reason(0), errno 104 (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) at /opt/processing/vendor/google/cloud/src/RequestWrapper.php:219) [stacktrace]


But after I re-run the codes, the error is gone.

I had run the codes (data process) for more than a year, I rarely saw this error before. Now, I moved my codes to a new server. I started to see this error. (It might be that this error happened before, just my old setup is not ignore to catch and log these errors.)

Due to the error report is from Google Cloud (less than 5% error rate), and re-run the codes, the error disappears, I think the error cause is from Google Cloud Platform.

Does anyone see the same errors? Are there anything we can do to prevent this error? Or we just have to code our process to retry when this error pops up?

Thanks!

Upvotes: 0

Views: 274

Answers (1)

Michael Powers
Michael Powers

Reputation: 2050

The error code you're getting (error 56) is defined as:

CURLE_RECV_ERROR (56)

Failure with receiving network data.

If you're getting this error it's likely you have a network issue that's causing your connections to break. Over the Internet you can expect to get this kind of error occasionally but rarely. If it's happening frequently there's probably something worse going on.

These types of network issues can be caused by a huge number of things but here's some possibilities:

  • Firewall or security software on your computer.
  • Network equipment (e.g. switches, routers, access points, firewalls, etc) or network equipment configuration.
  • An outage or intermittent connection between your ISP and Google (though it looks like Google wasn't detecting any outages recently).

When you're dealing with cloud storage providers (Google Storage, AWS S3, etc) you should always program in automatic retry logic for anything important. The Internet isn't always going to be perfectly reliable and it's best to plan for that in your code instead of relying on not having a problem.

Upvotes: 1

Related Questions