softlayer / softlayer-object-storage-php

SoftLayer Object Storage PHP Client
Other
28 stars 18 forks source link

Socket.php SSL3_WRITE_PENDING:bad write retry on Create() #31

Open sammydeveille opened 8 years ago

sammydeveille commented 8 years ago

Hi,

Thought I would log this issue.

Here is the 'out-of-the-box' code I am using for uploading files:

$options = array('adapter' => ObjectStorage_Http_Client::SOCKET, 'timeout' => 10);
$objStorage = new ObjectStorage('', '', '', $options);

try {
   $newFile = $objStorage->with('RemoteFilePath')
                   ->setLocalFile($PathTolocalFile)
                   ->create();

   return $newFile->getUrl();
}
catch (Exception $e) {
   return $e->getMessage();
}

For some reason, uploading a file that is under 1Mb works. But any file with a size bigger than this, the ->create() request eventually times out, no exception is thrown and I keep getting these error in my log:

xxx.xxx.xxx.xx - [05/06/16 03:47:02] Warning: fwrite(): SSL operation failed with code 1. OpenSSL Error messages:
error:1409F07F:SSL routines:SSL3_WRITE_PENDING:bad write retry (/var/www/vendor/softlayer/objectstorage/lib/ObjectStorage/Http/Adapter/Socket.php:132)

As those bindings are essentially a wrapper round curl, I then tested with CURL myself see if I could upload a file bigger than 1M to Softlayer Storage Container. It turns out it succeeded using CURL both on my dev machine and staging server!

curl -i -XPUT -H "X-Auth-Token: {{MyAuthToken}}" --data-binary "@BigFile.txt" https://lon02.objectstorage.softlayer.net/v1/{{MyAuthTokenKey}}/{{MyContainer}}/BigFile.txt

Have you ever come across this? Is this my machine? Thanks

vSaKv commented 8 years ago

I have the same issue. In fact it works fine on php 5.4.45, but php 5.5.x and up giving same time out.