Azure Table Api ignore timeout, when wrong host name is used
- Package Name:
azure-common==1.1.25 azure-core==1.6.0 azure-cosmos==4.0.0 azure-cosmosdb-nspkg==2.0.2 azure-cosmosdb-table==1.0.6 azure-nspkg==3.0.2
Windows 10
Python 3.7.3
Following code connect to the purposely wrong account:
table_service = TableService("WrongAccountHere", "Key", socket_timeout=3)
try:
retVal = table_service.insert_entity("IoT", blah, timeout = 3)
print (f"inserted to Azure: {retVal}")
except AzureException as e:
print (e)
return ({"Status": "error", "Error": str (e) })
Even though socket_timeout and timeout specified as 3 seconds, APIs takes a very long time to timeout (much more then 3 seconds)
Here is the error, as expected:
Client-Request-ID=793a5574-c098-11ea-af1e-705a0f42318f Retry policy did not allow for a retry: , HTTP status code=Unknown, Exception=HTTPSConnectionPool(host='wrongBlah.table.core.windows.net', port=443): Max retries exceeded with url: /IoT?timeout=3 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001A66BCA6518>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')).
Why are the timeout ignored?
@leonbrag thanks for reporting this, @annatisch can you take a look at this
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @klaaslanghout.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @anfeldma-ms, @zfoster, @southpolesteve.
Thanks @leonbrag - we are working on a new SDK for Tables that is in development here: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/tables/azure-data-tables
@seankane-msft - we have a test to validate the socket timeout for the Blobs SDK, can you please add an equivalent test for the new Tables SDK? https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/storage/azure-storage-blob/tests/test_blob_client.py#L195
Additionally an you confirm with the API reference documentation that timeout is a correct/support query parameter for this operation.
@leonbrag The query parameter you are looking for is actually called connection_timeout.
@leonbrag The new SDK for Tables was released in a preview state yesterday. It is available on pip with the command
pip install azure-data-tables
Your example would look like this with the new table
table_service = TableService("WrongAccountHere", "Key", socket_timeout=3)
try:
response = table_service.insert_entity(entity=entity, connection_timeout=3)
print(f"inserted to Azure: {retVal}")
except Exception as e:
print(e)
return ({"Status": "error", "Error": str(e)})
@leonbrag were you able to solve the issue?
While I have not tested it, go ahead and close as resolved. In case it’s not working, I will reopen. Thanks