gosnowflake
gosnowflake copied to clipboard
SNOW-559970: Client Panic when context canceled error received
This issue occurs when you try to monitor async query by passing cancelable context to WithFetchResultByID e.g.
ctx, cancel := context.WithCancel(context.Background())
sfCtx := sf.WithFetchResultByID(ctx, qid)
r,e := db.QueryWithContext(sfCtx, "")
cancel()
This is happening due to unchecked casting to SnowflakeError
ERRO[0108]monitoring.go:145 gosnowflake.(*snowflakeConn).checkQueryStatus failed to get response. err: context canceled
2022/03/15 13:24:40 Done loading internal Cookies JOB20220315132436515
panic: interface conversion: error is *errors.errorString, not *gosnowflake.SnowflakeError
goroutine 309 [running]:
github.com/snowflakedb/gosnowflake.(*snowflakeConn).QueryContext(0xc000aa8300, 0x1b12600, 0xc00096ea50, 0x0, 0x0, 0x242c698, 0x0, 0x0, 0x17b71a0, 0x7fbed4290d28, ...)
/opt/go_modules/pkg/mod/github.com/snowflakedb/[email protected]/connection.go:315 +0x269
database/sql.ctxDriverQuery(0x1b12600, 0xc00096ea50, 0x7fbed4076f18, 0xc000aa8300, 0x0, 0x0, 0x0, 0x0, 0x242c698, 0x0, ...)
/opt/softwares/go/src/database/sql/ctxutil.go:48 +0x227
database/sql.(*DB).queryDC.func1()
/opt/softwares/go/src/database/sql/sql.go:1643 +0x1de
database/sql.withLock(0x1afe100, 0xc0001d0a20, 0xc0001b9b40)
/opt/softwares/go/src/database/sql/sql.go:3284 +0x69
database/sql.(*DB).queryDC(0xc0002e60d0, 0x1b12600, 0xc00096ea50, 0x0, 0x0, 0xc0001d0a20, 0xc000987970, 0x0, 0x0, 0x0, ...)
/opt/softwares/go/src/database/sql/sql.go:1638 +0x5f4
database/sql.(*DB).query(0xc0002e60d0, 0x1b12600, 0xc00096ea50, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, ...)
/opt/softwares/go/src/database/sql/sql.go:1621 +0x136
database/sql.(*DB).QueryContext(0xc0002e60d0, 0x1b12600, 0xc00096ea50, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0007e8400, 0x0, ...)
/opt/softwares/go/src/database/sql/sql.go:1598 +0xd1