azure-sdk-for-python: Container client fails slowly instead of ResourceNotFound

  • azure-storage-blob
  • 12.3.2
  • Ubuntu 20.04
  • 3.8.2

Describe the bug I’ve been advised in #12744 to open a new issue for this behaviour.

I’m trying to use

from azure.storage.blob import ContainerClient

client = ContainerClient("storage1234567", container_name="container-01")
client.get_container_properties()

to check if a container exists. I had expected either an immediate ResourceNotFound or otherwise some unauthorised message - basically anything that would allow me to fail fast. Instead the command runs for about 2 minutes, retrying twice (three times in total, I believe with some backoff) resulting in

azure.core.exceptions.ServiceRequestError: <urllib3.connection.VerifiedHTTPSConnection object at 0x7f7bd6ef8bb0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution

I have also tried all the timeout kwargs I can think of, timeout, read_timeout, connection_timeout, socket_timeout (supplied as numeric or tuple) and none make a difference.

Is there a way to short-circuit this and allow me to catch some faster failure?

To Reproduce

from azure.storage.blob import ContainerClient

client = ContainerClient("storage1234567", container_name="container-01")
client.get_container_properties()

Expected behavior @tasherif-msft advises

Hi @AkhilGNair, interesting issue you’ve come across, but this is actually an unexpected behavior. The error you’re getting implies the request was not sent (you would receive a ResourceNotFound response from the server if the request was sent).

My expectation is that I can quickly catch a failure!

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (5 by maintainers)

Commits related to this issue

Most upvoted comments

This is great (and makes me feel stupid 😉) - the validation would be perfect as it was just the URL validation I was missing.

Creds are fine, no issue there - just wanted to catch the unauthorised error.

Thank you!

Hi @AkhilGNair

The error says “Temporary failure in name resolution” can you try to change the container name to “container01”