lib / pq

Pure Go Postgres driver for database/sql
https://pkg.go.dev/github.com/lib/pq
MIT License
9.01k stars 910 forks source link

http: panic serving [::1]:50061: runtime error: invalid memory address or nil pointer dereference goroutine 3 [running]: #942

Open Adebusy opened 4 years ago

Adebusy commented 4 years ago

Please how , kindly help me with solution to the below error message on Golang. Please what could be the reason for this error message and possible solution to it.

reated by net/http.(Server).Serve /usr/local/go/src/net/http/server.go:2884 +0x2f4 i am up and running.got here 1.2020/02/13 19:41:05 http: panic serving [::1]:60825: runtime error: invalid memory address or nil pointer dereference goroutine 3 [running]: net/http.(conn).serve.func1(0xc0001ad040) /usr/local/go/src/net/http/server.go:1769 +0x139 panic(0x1404960, 0x17c1fc0) /usr/local/go/src/runtime/panic.go:522 +0x1b5 database/sql.(DB).conn(0x0, 0x1505740, 0xc0000180c8, 0xc000053901, 0xc000053a00, 0x10621ad, 0xc0001bc428) /usr/local/go/src/database/sql/sql.go:1080 +0x3a database/sql.(DB).query(0x0, 0x1505740, 0xc0000180c8, 0x147ff6d, 0x2c, 0x0, 0x0, 0x0, 0x701, 0xb, ...) /usr/local/go/src/database/sql/sql.go:1513 +0x66 database/sql.(DB).QueryContext(0x0, 0x1505740, 0xc0000180c8, 0x147ff6d, 0x2c, 0x0, 0x0, 0x0, 0x0, 0x0, ...) /usr/local/go/src/database/sql/sql.go:1495 +0xd1 database/sql.(DB).Query(...)

gilwi commented 4 years ago

Hi there,

invalid memory address or nil pointer dereference
goroutine 3 [running]:
net/http.(*conn).serve.func1(0xc0001ad040)

This bit message specifically tells you it tried to get the value of *conn which had a nil value or an invalid address.

AFAIK your error could be related to your code, and could even not be related to this repo.

Please give us a little context so that we can "kindly help".