Tableau REST API request call conflict because of wrong variable initialization
andersonfellipe opened this issue · comments
Describe the bug
I use the tableauserverclient lib to publish data to a Tableau server. I have noticed that the version 0.26 introduced a code to run long requests on second thread #1212. This code has an issue that is causing intermittent request conflicts.
Versions
- Python version 3.10
- TSC library version 0.26
To Reproduce
Use the method datasources.publish to upload a hyper file to a Tableau server. If you do it multiple times (>10) eventually you will get a generic error that may be Internal Server Error (error code 500000) or Bad Request (error code 400011).
The issue is on the line 80
Then this if condition on the line 110 is True and the None is returned. According to the comment inside the if, it should be True only if there is a response to be returned
According to the initialization done on the method send_request_while_show_progress_threaded
, the line 80 of this file should be
self.async_response = -1
Results
This is the sequence of the current log when the request call conflict happens (with received None):
2023-12-13 02:44:23,576 - TSC - DEBUG - Publishing file `file.hyper`, size `851968`
2023-12-13 02:44:23,577 - TSC - INFO - Publishing file.hyper to server
2023-12-13 02:44:23,579 - TSC - DEBUG - request method post, url: fake_tableau_server_url/datasources?datasourceType=hyper&overwrite=true
2023-12-13 02:44:23,580 - TSC - DEBUG - [02:44:23] Begin blocking request to fake_tableau_server_url/datasources?datasourceType=hyper&overwrite=true
2023-12-13 02:44:24,581 - TSC - DEBUG - [02:44:24] Async request returned: received None
2023-12-13 02:44:24,581 - TSC - DEBUG - None
2023-12-13 02:44:24,582 - TSC - DEBUG - [02:44:24] Async request failed: retrying
2023-12-13 02:44:24,582 - TSC - DEBUG - [02:44:24] Begin blocking request to fake_tableau_server_url/datasources?datasourceType=hyper&overwrite=true
2023-12-13 02:44:24,995 - urllib3.connectionpool - DEBUG - https://fake_tableau_server_url.com:443 "POST /fake_api_path/datasources?datasourceType=hyper&overwrite=true HTTP/1.1" 201 None
2023-12-13 02:44:24,995 - TSC - DEBUG - [02:44:24] Call finished
2023-12-13 02:44:24,996 - TSC - DEBUG - [02:44:24] Request complete
2023-12-13 02:44:25,483 - urllib3.connectionpool - DEBUG - https://fake_tableau_server_url.com:443 "POST /fake_api_path/datasources?datasourceType=hyper&overwrite=true HTTP/1.1" 500 None
2023-12-13 02:44:25,484 - TSC - DEBUG - [02:44:25] Call finished
2023-12-13 02:44:25,485 - TSC - DEBUG - [02:44:25] Request complete
2023-12-13 02:44:25,485 - TSC - DEBUG - Response status: <Response [500]>
This is the sequence the log should have (with Waiting....):
2023-12-13 04:44:34,099 - TSC - DEBUG - Publishing file `file.hyper`, size `851968`
2023-12-13 04:44:34,100 - TSC - INFO - Publishing file.hyper to server
2023-12-13 04:44:34,105 - TSC - DEBUG - request method post, url: fake_tableau_server_url/datasources?datasourceType=hyper&overwrite=true
2023-12-13 04:44:34,106 - TSC - DEBUG - [04:44:34] Begin blocking request to fake_tableau_server_url/datasources?datasourceType=hyper&overwrite=true
2023-12-13 04:44:35,108 - TSC - DEBUG - 04:44:35 Waiting....
2023-12-13 04:44:36,335 - urllib3.connectionpool - DEBUG - https://fake_tableau_server_url.com:443 "POST /fake_api_path/datasources?datasourceType=hyper&overwrite=true HTTP/1.1" 201 None
2023-12-13 04:44:36,337 - TSC - DEBUG - [04:44:36] Call finished
2023-12-13 04:44:36,339 - TSC - DEBUG - [04:44:36] Request complete
2023-12-13 04:44:45,121 - TSC - DEBUG - [04:44:45] Async request returned: received <Response [201]>
2023-12-13 04:44:45,124 - TSC - DEBUG - Response status: <Response [201]>