Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isConnectionError #1495

Closed
sm2017 opened this issue Feb 13, 2018 · 4 comments
Closed

isConnectionError #1495

sm2017 opened this issue Feb 13, 2018 · 4 comments
Labels
guidance Question that needs advice or information.

Comments

@sm2017
Copy link

sm2017 commented Feb 13, 2018

In the following code

try {
    $client = new \Aws\S3\S3Client([
        'region' => 'us-west-2',
        'version' => 'latest',
        'http' => [
            'connect_timeout' => 5,
        ]
    ]);
   $result = $s3->getObject(array(
       'Bucket' => $bucket,
       'Key'    => $keyname
   ));
} catch (\Aws\Exception\AwsException $e) {
    var_dump($e->isConnectionError());
}

When connection timed out isConnectionError is false , I think it must be true

  • must be isConnectionError false?
  • How can I detect from \Aws\Exception\AwsException that connection is timed out , the S3 server is down , there is a network issue ,...
@kstich kstich added guidance Question that needs advice or information. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. Guzzle labels Feb 13, 2018
@kstich
Copy link
Contributor

kstich commented Feb 13, 2018

isConnectionError returns true for these cases if you use cURL and these cases if you use file streams. You can inspect the handler context via getHandlerContext on the underlying exception.

@sm2017
Copy link
Author

sm2017 commented Feb 14, 2018

@kstich When I use cURL it returns true and when stream it returns false and getHandlerContext is empty array , I NEED TO USE STREAM

@sm2017
Copy link
Author

sm2017 commented Feb 14, 2018

@kstich , I have a file located on multiple S3 servers
I want to create a script that detect server/network failure , When you request a file that located on server A , B and C , the script randomly pick a server for example B , the if B cannot serve file for any reason (Network failure , down time , ...) switch to server A

How can I detect it ? it seems isConnectionError is not my response

@kstich
Copy link
Contributor

kstich commented Feb 15, 2018

It looks like you've already submitted guzzle/guzzle#2012 to update their list of file stream based connection errors.

Closing this issue as it doesn't seem to be an issue with the SDK itself.

@kstich kstich closed this as completed Feb 15, 2018
@diehlaws diehlaws removed response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Apr 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

3 participants