You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed the panic below while running the service in production environment. My service does batch processing every hour and the issue happens randomly.
Stmt is nil because an error occurred. You must check each err value returned before you can assume anything about the state of other return values.
Unlike many projects on GitHub, the Go project does not use its bug tracker for general discussion or asking questions. We only use our bug tracker for tracking bugs and tracking proposals going through the Proposal Process.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
stmt, err := d.db.Prepare(d.sqlMap[stmtName])
defer closePreparedStmt(stmt)
if err != nil {
fmt.Printf("error preparing %s: %s\n", stmtName, err)
return "", err
}
results, err := stmt.Query()
I noticed the panic below while running the service in production environment. My service does batch processing every hour and the issue happens randomly.
What did you expect to see?
Results from the query instead of panic
What did you see instead?
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0xa0a523]
goroutine 3936 [running]:
sync.(*RWMutex).RLock(...)
/usr/local/go/src/sync/rwmutex.go:48
database/sql.(*Stmt).QueryContext(0x0, 0xcfde00, 0xc0000280a0, 0xc0020d7c58, 0x2, 0x2, 0x0, 0x0, 0x0)
/usr/local/go/src/database/sql/sql.go:2539 +0x53
database/sql.(*Stmt).Query(...)
/usr/local/go/src/database/sql/sql.go:2594
service.(*DBStore).GetAll(0xc000206180, 0xc0001102a0, 0xc, 0xc000164270, 0x24, 0x0, 0x0, 0x0, 0x0, 0x0)
database/sql.(*Stmt).QueryContext(0x0, 0xcfde00, 0xc0000a2068, 0xc000219c58, 0x2, 0x2, 0x0, 0x0, 0x0)
/src/pkg/xxx.go:418 +0x35b
The text was updated successfully, but these errors were encountered: