You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thereisaraceconditioninthe`SnowflakeConnection.execute_async()`functionalitywhere, dependingonhowquicklyresultsarereturned, anexceptionwilleitherberaisedbyget_query_status_throw_if_error() [1] withintheget_results_from_sfqid() call, orwithinwait_until_ready() [2] within (forexample) afetchall() call.
[1]: https://github.com/snowflakedb/snowflake-connector-python/blob/v3.0.2/src/snowflake/connector/cursor.py#L1400
[2]: https://github.com/snowflakedb/snowflake-connector-python/blob/v3.0.2/src/snowflake/connector/cursor.py#L1374Here'sanexample:
conn=snowflake.connector.connect(...)
cur=conn.cursor()
cur.execute_async(sql)
# A generic DatabaseError may be raised here...cur.get_results_from_sfqid(cur.sfqid)
# .. or a more helpful ProgrammingError may happen here.rows=cur.fetchall()
What did you expect to see?
I would expect the same exception to be produced from both get_results_from_sfqid() or fetchall() regardless of when the network request finishes. In my case the exception produced in wait_until_ready() is less useful since it discards the real SQL error code and message in favor of the more generic "Status of query '{}' is {}, results are unavailable".
Can you set logging to DEBUG and collect the logs?
Sorry, a bit difficult to isolate this into useful logs.
The text was updated successfully, but these errors were encountered:
github-actionsbot
changed the title
Race condition in execute_async() when an error occurs
SNOW-872652: Race condition in execute_async() when an error occurs
Jul 20, 2023
I have added this issue in our work queue. This will be prioritized based on engineering capacity but you are welcome to submit a PR to fix this issue.
hopefully this has been already fixed with one of the releases since. could you please re-test with the latest version of the connector (3.7.1) and let us know if you still can reproduce the issue ? thank you !
Python version
3.10.5
Operating system and processor architecture
macOS-13.4.1-arm64-arm-64bit
Installed packages
What did you do?
What did you expect to see?
I would expect the same exception to be produced from both
get_results_from_sfqid()
orfetchall()
regardless of when the network request finishes. In my case the exception produced inwait_until_ready()
is less useful since it discards the real SQL error code and message in favor of the more generic "Status of query '{}' is {}, results are unavailable".Can you set logging to DEBUG and collect the logs?
The text was updated successfully, but these errors were encountered: