davlee1972 commented on issue #1422:
URL: https://github.com/apache/arrow-adbc/issues/1422#issuecomment-1894326152

   Here's some additional debugging using SNOWSQL to generate a JWT token and 
using it to connect.. I mentioned above, the debugging options for the JWT 
token including the issuer generated by the ADBC / GO driver code  are limited 
and don't show the JWT token value being generated..
   
   Using https://jwt.io/ I verified that the jwt token used by SNOWSQL is:
   
   `"iss": "<my_account>.<my_login>.SHA256:qvmbDr2 etc.. etc.. etc.. 
Fs+1CYlU=",`
   which is account.login.fingerprint..
   
   Testing steps:
   
   1. Use SNOWSQL to connect to Snowflake using encrypted rsa private key file.
   2. Generate a JWT token using SNOWSQL
   3. Try connecting using ADBC using the JWT token generated as a file..
   
   ```
   snowsql --private-key-path rsa_key.p8 -a <my_account>.privatelink -u 
<my_login>
   Private Key Passphrase:
   * SnowSQL * v1.2.30
   Type SQL statements or !help
   
   snowsql --private-key-path rsa_key.p8 -a <my_account>.privatelink -u 
<my_login> --generate-jwt
   Enter private key file password (Press enter if none) []:
   eyJhbGciOiJSUzI1Ni
   etc.. etc.. etc..
   i86gxRk7w7QOTR8QvoxwQ
   ```
   
   ```
   >>> import adbc_driver_snowflake.dbapi
   >>>
   >>> jwt_token = "eyJhbGciOiJSUzI1Ni etc.. etc.. etc.. i86gxRk7w7QOTR8QvoxwQ"
   >>>
   >>> db_kwargs={
   ...     "adbc.snowflake.sql.account": "<my_account>",
   ...     "adbc.snowflake.sql.auth_type": "auth_jwt",
   ...     "adbc.snowflake.sql.client_option.auth_token": jwt_token,
   ...     "adbc.snowflake.sql.client_option.jwt_expire_timeout": "24h",
   ...     "adbc.snowflake.sql.client_option.tracing": "DEBUG",
   ...     "username": "<my_login>",
   ... }
   >>>
   >>> a_conn = adbc_driver_snowflake.dbapi.connect(db_kwargs=db_kwargs)
   time="2024-01-16T10:39:28-08:00" level=info msg=OpenWithConfig 
func="gosnowflake.(*defaultLogger).Info" file="log.go:216"
   time="2024-01-16T10:39:28-08:00" level=debug msg="OCSP Cache Server for 
Privatelink: 
http://ocsp.<my_account>.privatelink.snowflakecomputing.com/ocsp_response_cache.json\n"
 func="gosnowflake.(*defaultLogger).Debugf" file="log.go:148"
   time="2024-01-16T10:39:28-08:00" level=debug msg="OCSP Retry URL for 
Privatelink: 
http://ocsp.<my_account>.privatelink.snowflakecomputing.com/retry/%v/%v\n" 
func="gosnowflake.(*defaultLogger).Debugf" file="log.go:148"
   time="2024-01-16T10:39:28-08:00" level=info msg="Authenticating via 
SNOWFLAKE_JWT" func="gosnowflake.(*defaultLogger).Infof" file="log.go:154"
   time="2024-01-16T10:39:28-08:00" level=info msg="PARAMS for Auth: &map[], 
https, <my_account>.privatelink.snowflakecomputing.com, 443, 5m0s, 
SNOWFLAKE_JWT" func=gosnowflake.authenticate file="auth.go:353"
   time="2024-01-16T10:39:28-08:00" level=info msg="full URL: 
https://<my_account>.privatelink.snowflakecomputing.com:443/session/v1/login-request?requestId=ea8252a2-64fe-4526-4b72-e2024078d4aa&request_guid=eca249bc-5f1a-4172-4250-19931c223f89"
 func="gosnowflake.(*defaultLogger).Infof" file="log.go:154"
   time="2024-01-16T10:39:28-08:00" level=info msg="retryHTTP.totalTimeout: 
5m0s" func="gosnowflake.(*retryHTTP).execute" file="retry.go:294"
   time="2024-01-16T10:39:28-08:00" level=debug msg="retry count: 0" 
func="gosnowflake.(*defaultLogger).Debugf" file="log.go:148"
   Snowflake driver panicked, stack traces:
   goroutine 17 [running, locked to thread]:
   main.poison(0x0?, {0x7ffd4b1c2dbc, 0x12}, {0x7ffd4afc7e80, 0x7ffd4ae5e610})
           D:/a/arrow-adbc/arrow-adbc/adbc/go/adbc/pkg/snowflake/driver.go:165 
+0x87
   main.SnowflakeConnectionInit.func1()
           D:/a/arrow-adbc/arrow-adbc/adbc/go/adbc/pkg/snowflake/driver.go:952 
+0x51
   panic({0x7ffd4afc7e80, 0x7ffd4ae5e610})
           C:/hostedtoolcache/windows/go/1.20.8/x64/src/runtime/panic.go:884 
+0x213
   crypto/rsa.(*PrivateKey).Public(...)
           C:/hostedtoolcache/windows/go/1.20.8/x64/src/crypto/rsa/rsa.go:123
   github.com/snowflakedb/gosnowflake.prepareJWTToken(0xc0000c2e00)
           
C:/Users/runneradmin/go/pkg/mod/github.com/snowflakedb/[email protected]/auth.go:462
 +0x38
   github.com/snowflakedb/gosnowflake.createRequestBody(0xc0006b1b60, 
0xc000090200?, {{0x7ffd4b1b3bab, 0x2}, {0x7ffd4b1b8393, 0x7}, {0xc0000c6158, 
0x8}, {0x7ffd4b1b95bf, 0x9}}, ...)
           
C:/Users/runneradmin/go/pkg/mod/github.com/snowflakedb/[email protected]/auth.go:425
 +0x429
   github.com/snowflakedb/gosnowflake.authenticate.func1()
           
C:/Users/runneradmin/go/pkg/mod/github.com/snowflakedb/[email protected]/auth.go:336
 +0x6d
   github.com/snowflakedb/gosnowflake.(*retryHTTP).execute(0xc0005067e8)
           
C:/Users/runneradmin/go/pkg/mod/github.com/snowflakedb/[email protected]/retry.go:305
 +0x209
   github.com/snowflakedb/gosnowflake.postAuthRestful({0x7ffd4b40def8?, 
0xc00092cb40?}, 0x19?, 0xc000911190?, 0x7ffd4af273a0?, 0xc0000a8000?, 
0xc000491f58?, 0xc000491f30?)
           
C:/Users/runneradmin/go/pkg/mod/github.com/snowflakedb/[email protected]/restful.go:197
 +0x10f
   github.com/snowflakedb/gosnowflake.postAuth({0x7ffd4b40def8, 0xc00092cb40}, 
0xc0000c5040, 0x22?, 0xc00000a0f8, 0xc000506b00?, 0x7ffd4a94905a?, 
0xc000491e30?)
           
C:/Users/runneradmin/go/pkg/mod/github.com/snowflakedb/[email protected]/auth.go:229
 +0x34d
   github.com/snowflakedb/gosnowflake.authenticate({0x7ffd4b40def8, 
0xc00092cb40}, 0xc0006b1b60, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0})
           
C:/Users/runneradmin/go/pkg/mod/github.com/snowflakedb/[email protected]/auth.go:356
 +0xf8e
   github.com/snowflakedb/gosnowflake.authenticateWithConfig(0xc0006b1b60)
           
C:/Users/runneradmin/go/pkg/mod/github.com/snowflakedb/[email protected]/auth.go:547
 +0x398
   github.com/snowflakedb/gosnowflake.SnowflakeDriver.OpenWithConfig({}, {_, 
_}, {{0xc0008c47c0, 0x20}, {0xc0008cf920, 0x4}, {0x0, 0x0}, {0x0, ...}, ...})
           
C:/Users/runneradmin/go/pkg/mod/github.com/snowflakedb/[email protected]/driver.go:43
 +0x15e
   github.com/snowflakedb/gosnowflake.Connector.Connect({{0x7ffd4b400678, 
0x7ffd4bf0bc78}, {{0xc0008c47c0, 0x20}, {0xc0008cf920, 0x4}, {0x0, 0x0}, {0x0, 
0x0}, ...}}, ...)
           
C:/Users/runneradmin/go/pkg/mod/github.com/snowflakedb/[email protected]/connector.go:34
 +0x105
   
github.com/apache/arrow-adbc/go/adbc/driver/snowflake.(*databaseImpl).Open(0xc000923080,
 {0x7ffd4b40de88?, 0xc000038070?})
           
D:/a/arrow-adbc/arrow-adbc/adbc/go/adbc/driver/snowflake/snowflake_database.go:454
 +0x1f9
   
github.com/apache/arrow-adbc/go/adbc/driver/driverbase.(*database).Open(0x195b0446480?,
 {0x7ffd4b40de88?, 0xc000038070?})
           
D:/a/arrow-adbc/arrow-adbc/adbc/go/adbc/driver/driverbase/database.go:134 +0x2b
   main.SnowflakeConnectionInit(0x195b0493c78, 0x0?, 0xbd57eeee8)
           D:/a/arrow-adbc/arrow-adbc/adbc/go/adbc/pkg/snowflake/driver.go:968 
+0x118
   Traceback (most recent call last):
     File 
"C:\Users\<my_login>\Anaconda3\lib\site-packages\adbc_driver_snowflake\dbapi.py",
 line 120, in connect
       conn = adbc_driver_manager.AdbcConnection(db, **(conn_kwargs or {}))
     File "adbc_driver_manager\\_lib.pyx", line 676, in 
adbc_driver_manager._lib.AdbcConnection.__init__
     File "adbc_driver_manager\\_lib.pyx", line 232, in 
adbc_driver_manager._lib.check_error
   adbc_driver_manager.InternalError: INTERNAL: [Snowflake] AdbcConnectionInit: 
Go panic in Snowflake driver (see stderr): "invalid memory address or nil 
pointer dereference"
   
   During handling of the above exception, another exception occurred:
   
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File 
"C:\Users\<my_login>\Anaconda3\lib\site-packages\adbc_driver_snowflake\dbapi.py",
 line 126, in connect
       db.close()
     File "adbc_driver_manager\\_lib.pyx", line 470, in 
adbc_driver_manager._lib.AdbcDatabase.close
     File "adbc_driver_manager\\_lib.pyx", line 476, in 
adbc_driver_manager._lib.AdbcDatabase.close
     File "adbc_driver_manager\\_lib.pyx", line 232, in 
adbc_driver_manager._lib.check_error
   adbc_driver_manager.ProgrammingError: INVALID_STATE: [Snowflake] 
AdbcDatabaseRelease: Go panicked, driver is in unknown state
   
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to