Zend_Service_Amazon::getObjectSteam and copy() fail randomly

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Zend_Service_Amazon::getObjectSteam and copy() fail randomly

Michael Depetrillo
I have a command line process which downloads a video from Amazon S3 and
then re-uploads to another web service.

For some reason the call to copy() will randomly fail around 5% of the
time.  I've logged the error but I'm unable to make sense of the possible
problem.  Should stream_name be the path to my temporary file?  Is it
normal for the error message to only have 1 parameter for copy()?

This particular error did not appear the 2nd attempt to encode the file.
 I'm calling isObjectAvailable() before running the code below.

if (!copy($response->getStreamName(), $tmpFile)) {
            $errors= error_get_last();
            throw new Exception("Unable to copy file for Fliqz upload.
 Reason: " . print_r($response, true) . print_r($errors, true));

### Exception Message ###
Unable to copy file for Fliqz upload.  Reason: Zend_Http_Response_Stream
    [stream:protected] => Resource id #145
    [stream_name:protected] => /tmp/Zend_Http_ClientcMq8f0
    [_cleanup:protected] => 1
    [version:protected] => 1.1
    [code:protected] => 200
    [message:protected] => OK
    [headers:protected] => Array
            [X-amz-id-2] => dm0FdcLvEwW59quKqXIqcRznIjmtbH
            [X-amz-request-id] => A987D3D792644563
            [Date] => Tue, 06 Nov 2012 02:09:06 GMT
            [Last-modified] => Tue, 06 Nov 2012 01:28:28 GMT
            [Etag] => "2201dead982481ff1ac55d2fa543dfba"
            [Accept-ranges] => bytes
            [Content-type] => binary/octet-stream
            [Content-length] => 111022966
            [Server] => AmazonS3

    [body:protected] =>
    [type] => 2
    [message] => copy(/var/www/source/application/../data/tmp/
1780p17b9l9qh8moi14r23n5ogc13uh1.mp4): failed to open stream: No such file
or directory

Michael DePetrillo
Mobile: (858) 761-1605