-
Notifications
You must be signed in to change notification settings - Fork 170
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-1764129: Result set iteration fails with 403 error 4 hours after query completes #1941
Comments
@ehclark I don't believe the issue you're running into is related to the JDBC driver. We'll need sensitive information from you to debug this, so the best avenue here would be for you to open a ticket with Snowflake Support. To explain very briefly, there's a limit imposed by the backend for the lifetime of the results for a query. If the client takes a longer time to process the results then you'll hit a 403 error, and there's nothing the JDBC driver could do about it. By default, that expiry time is 6 hours, and it's 4 hours in case you're using the Spark connector. When you open a support ticket you'll need to provide the JDBC debugging logs and account information. |
@sfc-gh-wfateem According to the Snowflake documentation on RESULT_SCAN() function, results are available for 24 hours after query completion. I think the problem is that in the JDBC driver, a manifest of result chunks for the query is downloaded. That manifest includes pre-signed URLs that apparently have a TTL of 4 hours. So it seems that the JDBC driver should detect when those pre-signed URLs are stale, but the results of the query are still available and fetch a new manifest. |
@ehclark Those are slightly two different things. When you run a query, you can possibly hit the cache for the next 24 hours. This means that Snowflake won't have to run your query again and will simply point you back to the cached results. However, you can't download any results, whether that's cached or new data, until pre-signed URLs are generated. The pre-signed URL is going to be valid for a finite amount of time from the point when the query finishes running, i.e., the time the URLs are generated. I can look into trying to reproduce this by attempting to parse a large amount of data, hoping that I go beyond 4 hours, but that's going to take some time. |
@ehclark I had a job run overnight and it behaved exactly how I would expect it to. Here I received the response to my query indicating that it finished running around that time, so we can also expect pre-signed URLs to be generated around the same time:
Here are the times it started downloading the first chunk and then the last chunk before the failure:
It went on trying to download chunk# 1086:
That failed:
The reason for the failure:
The timestamp provided by S3 is in GMT, the timestamps shown in my logs are in US CDT (-5 UTC). So you can see that this failure occurred at the six-hour mark, which is the current configuration for my particular account dictating how long pre-signed URLs are valid for. Your issue looks pretty different, and without having the opportunity to get more details from you including the debugging logs, then it's very hard to say what's happening in your scenario. Just FYI, I used |
@sfc-gh-wfateem Thanks for the follow up. I think the error you are seeing is the same as what I am seeing, the differences have to do with Azure vs AWS. You referred to:
Is that a Snowflake parameter? I did not find a parameter in the documentation that would appear to control that, so maybe it is a private parameter? |
@ehclark ah yes! I overlooked the fact that you're connecting to an Azure blob storage server. Yes, you wouldn't have control over that parameter. I'm just unsure if this is the same issue or not because the default is 6 hours. Users typically ask to increase that, I haven't seen a scenario where someone asked to reduce that time. Either way, we can definitely help you with this if you can open a support ticket with us. |
@ehclark If you don't have any other questions, I'll go ahead and close this issue for now given that this looks more like an issue with the environment rather than the JDBC driver. As I mentioned earlier, please do reach out to Snowflake support to help you look into this. If you find new information that's relevant to this issue and you suspect that there's something in the JDBC driver that needs to be looked at, then please feel free to open the issue again. |
Please answer these questions before submitting your issue.
In order to accurately debug the issue this information is required. Thanks!
The signed expiry time mentioned in the error log is exactly 4 hours after the query completed. It would appear that the authentication tokens used to download the chunks from object storage are generated when the query completes and valid for up to 4 hours.
What did you expect to see? The program should run to completion. The result set for a query should be available to iterate as long as the session is still open and valid.
Can you set logging to DEBUG and collect the logs?
https://community.snowflake.com/s/article/How-to-generate-log-file-on-Snowflake-connectors
Before sharing any information, please be sure to review the log and remove any sensitive
information.
The text was updated successfully, but these errors were encountered: