Issues

ZF-11436: Zend_Service_Amazon_S3: method _makeRequest 400 error codes

Description

Amazon often returns the following error with a httpd status code of 400. This happens on remote file stream when the remote server lags a bit. It is not consistent but should be accounted for.

Zend_Http_Response Object ( [version:protected] => 1.1 [code:protected] => 400 [message:protected] => Bad Request [headers:protected] => Array ( [X-amz-request-id] => BE215CC78852E021 [X-amz-id-2] => a5+9JaMxaPRcjfASrAQwFjc0TUn0+tylj/PNy3+OxSY13HvT+aM7i+82u349HbdE [Content-type] => application/xml [Transfer-encoding] => chunked [Date] => Thu, 02 Jun 2011 23:30:12 GMT [Connection] => close [Server] => AmazonS3 )

[body:protected] => 15c

<?xml version="1.0" encoding="UTF-8"?> RequestTimeoutYour socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed.BE215CC78852E021

Current code in method _makeRequest:

do { $retry = false;

        $response = $client->request($method);
        $response_code = $response->getStatus();

        // Some 5xx errors are expected, so retry automatically
        if ($response_code >= 500 && $response_code < 600 && $retry_count <= 5) {
            $retry = true;
            $retry_count++;
            sleep($retry_count / 4 * $retry_count);
        }
        else if ($response_code == 307) {
            // Need to redirect, new S3 endpoint given
            // This should never happen as Zend_Http_Client will redirect automatically
        }
        else if ($response_code == 100) {
            // echo 'OK to Continue';
        }
    } while ($retry);

Comments

No comments to display