odbc icon indicating copy to clipboard operation
odbc copied to clipboard

QueryContext raises `panic: send on closed channel`

Open Shamus03 opened this issue 6 months ago • 2 comments

After the recent commit to add support for QueryContext: https://github.com/alexbrainman/odbc/commit/1293aff3fc513fdd5e9d521b64e35bf56fba8d22#diff-4f427d2b022907c552328e63f137561f6de92396d7a6e8f6c2ea1bcf0db52654R153

We are getting the following error:

Thursday, August 15th 2024 @ 3:41:50 pm	panic: send on closed channel
Thursday, August 15th 2024 @ 3:41:50 pm	goroutine 4794 [running]:
Thursday, August 15th 2024 @ 3:41:50 pm	github.com/alexbrainman/odbc.(*Conn).wrapQuery(0x1?, {0x99c900, 0xc0002a0150}, 0xc00031e320, {0xeb7c20?, 0x6fcc68?, 0xc0004c37d0?}, 0x6f20e5?, 0xc0007aa570?)
Thursday, August 15th 2024 @ 3:41:50 pm	/root/go/src/github.com/alexbrainman/odbc/conn.go:153 +0x145
Thursday, August 15th 2024 @ 3:41:50 pm	created by github.com/alexbrainman/odbc.(*Conn).QueryContext in goroutine 4792
Thursday, August 15th 2024 @ 3:41:50 pm	/root/go/src/github.com/alexbrainman/odbc/conn.go:104 +0x389

It is inside this goroutine: https://github.com/alexbrainman/odbc/commit/1293aff3fc513fdd5e9d521b64e35bf56fba8d22#diff-4f427d2b022907c552328e63f137561f6de92396d7a6e8f6c2ea1bcf0db52654R104

And it seems to kill the connection or permanently damage/deadlock it.

For context: we are using unixodbc to connect to an IBM DB2 database running on an AS400. Hopefully that is helpful.

Working on steps to reproduce, but I haven't been able to nail it yet. We have about 20-30 service instances using this version of the package, and they die with this error slowly over time.

Shamus03 avatar Aug 15 '24 20:08 Shamus03