snowflake-connector-net icon indicating copy to clipboard operation
snowflake-connector-net copied to clipboard

SNOW-406933: Proxy-based connection in Linux OS returns SnowflakeDbException: Request reach its timeout.

Open leszek95b opened this issue 3 years ago • 6 comments

Issue description

Unable to connect in 2.0.4 version using proxy only in Linux systems. The same code, the same setup, the same network - connection works well from Windows OS.

Example code

using var connection = new SnowflakeDbConnection { ConnectionString = GetConnectionString() };
connection.Open();

private string GetConnectionString()
        {
            var connectionStringBuilder = new SnowflakeDbConnectionStringBuilder
            {
                { "account", "myaccount" },
                { "user", "myuser" },
                { "authenticator", "snowflake_jwt" },
                { "private_key_file", "mykey.p8" },
                { "private_key_pwd", "mypassword" },
                { "useproxy", "true" },
                { "proxyhost", "myhost" },
                { "proxyport", "8080" },
                { "proxyuser", "myproxyuser" },
                { "proxypassword", "myproxypassword" }
            };

            return connectionStringBuilder.ConnectionString;
        }

Error log

Snowflake.Data.Client.SnowflakeDbException
  HResult=0x80004005
  Message=Snowflake Internal Error: Unable to connect. One or more errors occurred. (Request reach its timeout.)
  Source=Snowflake.Data
  StackTrace:
   at Snowflake.Data.Client.SnowflakeDbConnection.Open()
   at SnowflakeClient.SnowflakeAdapter.GetSnowflakeTable(String query) in C:\repo\SnowflakeClient\SnowflakeClient\SnowflakeAdapter.cs:line 19
   at SnowflakeClient.Program.Main(String[] args) in C:\repo\SnowflakeClient\SnowflakeClient\Program.cs:line 10

  This exception was originally thrown at this call stack:
    Snowflake.Data.Core.RestRequester.SendAsync(System.Net.Http.HttpRequestMessage, System.TimeSpan, System.Threading.CancellationToken)
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
    Snowflake.Data.Core.RestRequester.SendAsync(System.Net.Http.HttpMethod, Snowflake.Data.Core.IRestRequest, System.Threading.CancellationToken)
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
    ...
    [Call Stack Truncated]

Inner Exception 1:
AggregateException: One or more errors occurred. (Request reach its timeout.)

Inner Exception 2:
SnowflakeDbException: Request reach its timeout.

Configuration

*Driver version: *2.0.4

Dotnet framework and version: netcoreapp3.1, net5.0

Server version: 5.29.1

Client OS: Debian 9.5 WSL2 @ Windows 10, Docker container Centos 7.5 based.

leszek95b avatar Jul 27 '21 14:07 leszek95b

@leszek95b what is the actual account name? If you have underscores in it, you're gonna have a bad time. Change them to hyphens and give it a try.

Possibly related, https://github.com/snowflakedb/snowflake-connector-net/issues/160 and https://github.com/dotnet/runtime/issues/35880

alexrosenfeld10 avatar Jul 27 '21 14:07 alexrosenfeld10

Account name is 2 small case letters and 5 digits. Pattern is like ab12345. Full account name in connection string is ab12345.eu-central-1. There are no underscores in hostnames. There are underscores in connection string fields: user, authenticator, private_key_file, private_key_pwd, but this is not related to DNS hence should have no impact.

leszek95b avatar Jul 27 '21 15:07 leszek95b

🤷 sorry, not sure how to help you. I am just a user as well.

alexrosenfeld10 avatar Jul 27 '21 15:07 alexrosenfeld10

Connection works with { "insecuremode", "true" } in Linux. Since there is different behavior in Windows and Linux in this same network, this same code, this same .NET framework and SF service, why such a difference?

leszek95b avatar Jul 28 '21 08:07 leszek95b

@leszek95b We currently only test and support on Windows OS. We are working on a plan to add proper test coverage and support for other platforms. Targeting Q4 to have this support (tentatively). We will look into this as part of that work effort.

sfc-gh-hkapre avatar Sep 02 '21 21:09 sfc-gh-hkapre

@sfc-gh-hkapre - I don't think this has to do with linux and may be related to #377 which I just filed.

malhotrar avatar Sep 21 '21 17:09 malhotrar

To clean up and re-prioritize more pressing bugs and feature requests we are closing all issues older than 6 months as of April 1, 2023. If there are any issues or feature requests that you would like us to address, please create them according to the new templates we have created. For urgent issues, opening a support case with this link Snowflake Community is the fastest way to get a response.

sfc-gh-jtang avatar May 25 '23 17:05 sfc-gh-jtang