Open vc-74 opened 3 months ago
hi and thank you for raising this with us. So I'm trying to reproduce the problem using .NET Core 6.0 (which is supported by the driver) and Snowflake.Data v3.0.0 and this repro program:
using System.Data.Common;
using Snowflake.Data.Client;
class Program
{
static async Task Main(string[] args)
{
string connectionString = "account=myaccount.eu-central-1; " +
" user=admin; password=password; role=ACCOUNTADMIN;" +
" DB=TEST_DB; warehouse=COMPUTE_WH;" +
" useproxy=true;proxyhost=no.such.pro.xy;proxyport=8080";
try
{
await ConnectToSnowflakeAsync(connectionString);
}
catch (Exception ex)
{
Console.WriteLine($"Error connecting to Snowflake: {ex.Message}");
}
}
static async Task ConnectToSnowflakeAsync(string connectionString)
{
using (var connection = new SnowflakeDbConnection())
{
connection.ConnectionString = connectionString;
await connection.OpenAsync().ConfigureAwait(false);
Console.WriteLine("Connected to Snowflake!");
await ExecuteQueryAsync(connection, "SELECT current_timestamp()");
await connection.CloseAsync();
}
}
static async Task ExecuteQueryAsync(DbConnection connection, string query)
{
using (var command = connection.CreateCommand())
{
command.CommandText = query;
using (var reader = await command.ExecuteReaderAsync())
{
while (await reader.ReadAsync())
{
Console.WriteLine($"Current Timestamp: {reader[0]}");
}
}
}
}
}
and what I'm seeing after running the program, that it gets hung for ~1.5 minutes, then bails out with
Connected to Snowflake!
Error connecting to Snowflake: Error: Executing command on a non-opened connection. SqlState: , VendorCode: 270059, QueryId:
so I could not get to the 'no exception is thrown' ; i'm getting an error after all. Without the non-existing proxy part, the query is successfully run.
if you're seeing something different, could you please provide us with a minimal viable and runnable code which when run, leads to the issue you're experiencing?
so I could not get to the 'no exception is thrown' ; i'm getting an error after all. Without the non-existing proxy part, the query is successfully run.
You actually did, the exception is thrown by ExecuteQueryAsync
, not OpenAsync
. You did not include the stack trace but it's probably what it says. I would expect OpenAsync
to throw the exception instead.
ah - you're right. Got you now. We'll take a look - thanks for drawing our attention to this one !
@sfc-gh-dszmolka Hi, any ETA for the resolution of this issue? Thanks
hey - no fixed ETA known at this moment but i'm syncing internally on this one and will update this thread once I got any estimated delivery. (to set the expectations: the very earliest possible is at the end of this month with the April release cycle, if we fall outside of that, then in the May release cycle)
will post the further details once known - thank you for bearing with us !
Thanks. I have a related question: does the connector only take the specified proxy parameters into account, or does it also take the user/system configured proxy into account?
the supported way of specifying the proxy is to use USEPROXY & co. as described in the README, specified in the connection string.
I never tested with the system-wide envvars like HTTP_PROXY
/ HTTPS_PROXY
so it might or might not work, need to test it. Specifying the proxy as .pac
file, should not work (for any of the Snowflake drivers)
I don't think these environment variables are taken into account but it seems like even when I specify a proxy manually, my WinInet configuration is used.
if you wish to discuss this second topic (on the proxy) further or even suspect there is a bug, could you please raise a separate Issue for it ? Seems a bit unrelated to the original issue which revolves around how OpenAsync
behaves and allows dependent queries to proceed (and surely fail) instead of failing fast.
You're right, thanks
What version of .NET driver are you using? 3.0.0
What operating system and processor architecture are you using? Windows Server 2019 X64
What version of .NET framework are you using? .net8
What did you do? In the connection string, if a proxy is specified but cannot be reached,
OpenAsync
times out (as expected) but no exception is thrown resulting in a connection whichState
isClosed
.What did you expect to see?
An exception should be raised in case the connection cannot be opened.
Can you set logging to DEBUG and collect the logs?
Not relevant.
What is your Snowflake account identifier, if any? (Optional)