it's something like
https://github.com/golang/go/issues/64498
Scan locks but doesn't always unlock when it returns,
which causes a deadlock with your deferred close which also tries to lock.
If you run it with CGO_ENABLED=0, you'll also get a nice deadlock report:
fatal error: all goroutines are asleep - deadlock!
goroutine 1 [sync.RWMutex.Lock]:
sync.runtime_SemacquireRWMutex(0x0?, 0x0?, 0x9d8f00?)
runtime/sema.go:105 +0x25
sync.(*RWMutex).Lock(0x10?)
sync/rwmutex.go:155 +0x6b
database/sql.(*Rows).close(0x235702c1e0a0, {0x0, 0x0})
database/sql/sql.go:3452 +0xad
database/sql.(*Rows).Close(0x235702c1e0a0)
database/sql/sql.go:3448 +0x26
panic({0x70f240?, 0x7a6910?})
runtime/panic.go:856 +0x13a
main.(*field).Scan(0x9cb2d0?, {0x716700?, 0x0?})
go.seankhliao.com/testrepo1314/main.go:28 +0x25
database/sql.convertAssignRows({0x716700, 0x235702c20050}, {0x70f400,
0x7b16d0}, 0x235702c1e0a0)
database/sql/convert.go:394 +0x1fd9
database/sql.(*Rows).scanLocked(0x235702c1e0a0, {0x235702c32080, 0x4,
0x48e889?})
database/sql/sql.go:3406 +0x38c
database/sql.(*Rows).Scan(0x235702c1e0a0, {0x235702c32080, 0x4, 0x7439bc?})
database/sql/sql.go:3374 +0x73
main.main()
go.seankhliao.com/testrepo1314/main.go:72 +0x535
goroutine 17 [select]:
database/sql.(*DB).connectionOpener(0x235702c90000, {0x7a7df8, 0x235702c8a000})
database/sql/sql.go:1261 +0x89
created by database/sql.OpenDB in goroutine 1
database/sql/sql.go:841 +0x145
exit status 2
- sean
- sean
> --
> You received this message because you are subscribed to the Google Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
golang-nuts...@googlegroups.com.
> To view this discussion visit
https://groups.google.com/d/msgid/golang-nuts/f1068b9389dccbd11c13e942a0bceaec2aada8f7.camel%40andrewpillar.com.