-
Notifications
You must be signed in to change notification settings - Fork 473
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
SNOW-1643781: Async queries: unable to re-establish connection/keep connection alive #2038
Comments
hi - thanks for submitting this issue and especially for the reproduction. taking a look . |
i can confirm the async query gets cancelled anyways after 5 minutes even though the additional 'heartbeat' queries happening every 2 minutes. Apparently, a single query will not be recognized as a heartbeat. We have a private function to send request to snowflake to keep the connection alive (this is happening when client_session_keep_alive is set) - will check how it can be utilized in this scenario to properly send requests to edit: replaced the |
tested various methods to no avail, until my colleague @sfc-gh-hachouraria figured out that sending a request to This is done by issuing Of course there aren't really any query results in the Can you please try it and let us know if it works for you ? |
Switching out
In addition:
I'll keep experimenting a bit more |
Since the endpoint takes 30-50 sec to respond, I'm thinking of running it in a thread with Just a little worried about potential bad resource cleanup though |
Hi, we have confirmed that when |
In my testing, that GET will return early if the query completes and otherwise block Snowflake-side for up to ~40sec before returning "Query execution in progress". This means that overall the query does remains async, and this is a valid (but clunky) workaround. I would like to be able to keep async queries alive even if ABORT_DETACHED_QUERY is set to True, and there are a handful of possible options: With zero Snowflake support:
Various things Snowflake could support:
which (or any other) option can be considered? |
Hi @Kache, |
Python version
Python 3.11.4 (main, Jan 10 2024, 15:34:31) [Clang 15.0.0 (clang-1500.1.0.2.5)]
Operating system and processor architecture
Linux-6.10.6-orbstack-00249-g92ad2848917c-x86_64-with-debian-10.13
Installed packages
What did you do?
I want to log the query id without needing to wait for the query to have completed.
Starting from sync usage:
Attempt: use async
However, the above only works for fast queries. We use
ABORT_DETACHED_QUERY = TRUE
because we want queries to passively stop if/when the tasks/processes driving the original query stop/terminate, so queries > 5 mins get canceled:Although docs says:
It also says:
Sounds like just need a way to either keep the connection alive or re-connect.
Attempt: use async,
ABORT_DETACHED_QUERY
, and active heartbeat queries to "keep alive"However, the query gets cancelled all the same in 5 minutes.
Using a "re-connect" strategy by using a new
connection
every couple minutes (rather than using the sameconnection
) is similarly ineffective.What did you expect to see?
Expected to be able to prevent an async query from being canceled even though
ABORT_DETACHED_QUERY = TRUE
by either actively keeping the connection alive or by actively re-connecting.Keeping
ABORT_DETACHED_QUERY = TRUE
is desirable because we want queries to passively stop if/when the tasks/processes driving the original query stop/terminate.Can you set logging to DEBUG and collect the logs?
n/a
The text was updated successfully, but these errors were encountered: