Skip to content
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-905751: Snowflake.Data connection failed in linux, succeeded in windows #767

Closed
dreamGirl1996 opened this issue Sep 1, 2023 · 2 comments
Assignees

Comments

@dreamGirl1996
Copy link

Please answer these questions before submitting your issue.
In order to accurately debug the issue this information is required. Thanks!

  1. What version of .NET driver are you using?
    2.0.0 or 2.1.1

  2. What operating system and processor architecture are you using?
    linux

  3. What version of .NET framework are you using?
    net6.0

  4. What did you do?
    When I run following code in windows, it connection opened. While run in linux, it throws:
    Unhandled exception. System.AggregateException: One or more errors occurred. (A task was canceled.)
    ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
    at System.Threading.Tasks.Task.GetExceptions(Boolean includeTaskCanceledExceptions)
    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
    at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task1.get_Result()
    at Snowflake.Data.Core.RestRequester.Post[T](IRestRequest request)
    at Snowflake.Data.Core.Authenticator.BaseAuthenticator.Login()
    at Snowflake.Data.Core.Authenticator.BasicAuthenticator.Snowflake.Data.Core.Authenticator.IAuthenticator.Authenticate()
    at Snowflake.Data.Core.SFSession.Open()
    at Snowflake.Data.Client.SnowflakeDbConnection.Open() -- .NET driver 2.0.0

Error Message: Error: Snowflake Internal Error: Unable to connect. One or more errors occurred. (A task was canceled.) SqlState: 08006, VendorCode: 270001, QueryId: -- .NET driver 2.1.1

using (IDbConnection conn = new SnowflakeDbConnection())
{
conn.ConnectionString = "password=xxx;account=xxx;user=xxx;db=xxx;warehouse=xxx;role=xxx;host=xxx;region=xxx";

conn.Open();

}

  1. What did you expect to see?

    Connection succeeds in linux, thanks

  2. Can you set logging to DEBUG and collect the logs?

    https://community.snowflake.com/s/article/How-to-generate-log-file-on-Snowflake-connectors

    There is an example in READMD.md file showing you how to enable logging.

  3. What is your Snowflake account identifier, if any? (Optional)

@github-actions github-actions bot changed the title Snowflake.Data connection failed in linux, succeeded in windows SNOW-905751: Snowflake.Data connection failed in linux, succeeded in windows Sep 1, 2023
@sfc-gh-dszmolka
Copy link
Contributor

sfc-gh-dszmolka commented Sep 12, 2023

hi and thank you for submitting this issue. I tried to reproduce it but couldn't yet. Here's the steps I've taken in an attempt to reproduce it.

Set up environment

$ docker run --rm -ti mcr.microsoft.com/dotnet/sdk:6.0 /bin/bash

root@03192d178f3c:/test# dotnet --list-runtimes
Microsoft.AspNetCore.App 6.0.21 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.21 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

root@03192d178f3c:/test# grep ^PRETTY /etc/*release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"

root@03192d178f3c:/test# dotnet new console
[..gets initialized..]

root@03192d178f3c:/test# dotnet add package Snowflake.Data --version 2.1.1
[..Snowflake .NET Driver 2.1.1 gets installed..]

Repro program

# cat Program.cs 
using System;
using System.Data;
using System.Data.Common;
using Snowflake.Data.Client;
namespace SnowflakeTestProgram 
{
    class Program
    {
        private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
        static void Main(string[] args)
        {
            try
            {
                using (IDbConnection conn = new SnowflakeDbConnection())
                {
                    conn.ConnectionString = "account=myaccount; user=admin; password=mypassword; DB=TEST_DB; SCHEMA=PUBLIC";
                    conn.Open();
                    Console.WriteLine("Connection successful!");
                    using (IDbCommand cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "select current_user()"; 
                        IDataReader reader = cmd.ExecuteReader();
                        while (reader.Read())
                        {
                            Console.WriteLine(reader.GetString(0));
                        }
                        conn.Close();
                    }
                }
            }
            catch (DbException exc)
            {
                Console.WriteLine("Error Message: {0}", exc.Message);
            }
        }
    }
}

Run the repro program

root@03192d178f3c:/test# dotnet run Program.cs 
/test/Program.cs(9,81): warning CS8602: Dereference of a possibly null reference. [/test/test.csproj]
Connection successful!
ADMIN

Successfully connects to Snowflake and executes a query.

So can confirm Snowflake .NET Driver version 2.1.1 does work under Linux. But perhaps your situation is different from the above setup.

For next step, could you please:

  1. Try to leave host and region out of the connection setup, and use the account as specified in the Snowflake documentation about Account Identifiers if you're using the 'locator' version, or just simply use the regionless (orgname-accountname) version.

  2. If it still doesn't work, please send:

  • the exact steps of setting up the environment / details of the OS, runtime, etc. seen above
  • the full runnable code you're using, which is a minimal viable representation of the issue reproduction

I would like to use a repro as closely resembling your situation as possible. Thank you in advance !

@sfc-gh-dszmolka sfc-gh-dszmolka added status-triage Issue is under initial triage status-information_needed Additional information is required from the reporter and removed bug labels Sep 12, 2023
@sfc-gh-dszmolka sfc-gh-dszmolka self-assigned this Sep 12, 2023
@sfc-gh-dszmolka
Copy link
Contributor

there's been no response on this for a while now, so marking it closed. If you require further help, please answer the questions accordingly and/or provide reproduction/logs, and I'll reopen the issue.

@sfc-gh-dszmolka sfc-gh-dszmolka closed this as not planned Won't fix, can't repro, duplicate, stale Oct 2, 2023
@sfc-gh-dszmolka sfc-gh-dszmolka removed status-triage Issue is under initial triage status-information_needed Additional information is required from the reporter labels Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants