henson / proxypool

Golang实现的IP代理池
Apache License 2.0
1.65k stars 341 forks source link

panic: runtime error: invalid memory address or nil pointer dereference #51

Closed Felyne closed 4 years ago

Felyne commented 5 years ago

启动报错 panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0xc8 pc=0x7fdf60]

goroutine 19 [running]: github.com/go-xorm/xorm.(Session).Init(0xc0000ed080) /home/chen/work/gopath/pkg/mod/github.com/go-xorm/xorm@v0.7.6/session.go:94 +0x200 github.com/go-xorm/xorm.(Engine).NewSession(...) /home/chen/work/gopath/pkg/mod/github.com/go-xorm/xorm@v0.7.6/engine.go:317 github.com/go-xorm/xorm.(*Engine).Where(0x0, 0xa025a0, 0xb8acd0, 0xc0001425d0, 0x1, 0x1, 0x0) /home/chen/work/gopath/pkg/mod/github.com/go-xorm/xorm@v0.7.6/engine.go:594 +0x57 github.com/henson/proxypool/pkg/models.countIps(0x0) /home/chen/work/gopath/src/github.com/henson/proxypool/pkg/models/ip.go:39 +0x97 github.com/henson/proxypool/pkg/models.CountIPs(...) /home/chen/work/gopath/src/github.com/henson/proxypool/pkg/models/ip.go:45 github.com/henson/proxypool/pkg/storage.CheckProxyDB() /home/chen/work/gopath/src/github.com/henson/proxypool/pkg/storage/filter.go:60 +0x35 main.main.func2() /home/chen/work/gopath/src/github.com/henson/proxypool/main.go:31 +0x20 created by main.main /home/chen/work/gopath/src/github.com/henson/proxypool/main.go:30 +0x8a

sndnvaps commented 5 years ago

你直接改一改源代码啊,再编译它。 加个,你得把你运行的命令写一写,不然鬼知道你是怎样测试导致问题的啊。

liliang8858 commented 4 years ago

panic: runtime error: invalid memory address or nil pointer dereference

`# ./proxy 2019/12/30 11:40:57 [TRACE] Log path: 2019/12/30 11:40:57 [TRACE] Log Mode: File (Info) 2019/12/30 11:40:57 [ INFO] ProxyPool panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0xd0 pc=0x817006]

goroutine 1 [running]: github.com/go-xorm/xorm.(Session).Init(0xc00018c700) /usr/local/gopath/pkg/mod/github.com/go-xorm/xorm@v0.7.9/session.go:94 +0x1e6 github.com/go-xorm/xorm.(Engine).NewSession(...) /usr/local/gopath/pkg/mod/github.com/go-xorm/xorm@v0.7.9/engine.go:317 github.com/go-xorm/xorm.(*Engine).Where(0x0, 0xa198e0, 0xbb0100, 0xc0000f2c40, 0x1, 0x1, 0xc00013def8) /usr/local/gopath/pkg/mod/github.com/go-xorm/xorm@v0.7.9/engine.go:601 +0x56 github.com/henson/proxypool/pkg/models.countIps(0x8) /usr/local/gopath/pkg/mod/github.com/henson/proxypool@v0.0.0-20191224115608-13ffa479b44c/pkg/models/ip.go:46 +0x8a github.com/henson/proxypool/pkg/models.CountIPs(...) /usr/local/gopath/pkg/mod/github.com/henson/proxypool@v0.0.0-20191224115608-13ffa479b44c/pkg/models/ip.go:52 main.main() /usr/local/proxy/proxypool/main.go:45 +0xdd`

liliang8858 commented 4 years ago

再次允许成功,但是访问一次既异常:

2019/12/30 11:49:13 http: panic serving 115.236.179.140:60598: runtime error: invalid memory address or nil pointer dereference goroutine 300 [running]: net/http.(conn).serve.func1(0xc000641680) /usr/local/go/src/net/http/server.go:1767 +0x139 panic(0xa4cd60, 0x1163270) /usr/local/go/src/runtime/panic.go:679 +0x1b2 github.com/henson/proxypool/pkg/storage.ProxyRandom(0xa81420) /usr/local/gopath/pkg/mod/github.com/henson/proxypool@v0.0.0-20191224115608-13ffa479b44c/pkg/storage/filter.go:90 +0xc6 github.com/henson/proxypool/api.ProxyHandler(0xbc7660, 0xc0006128c0, 0xc000349c00) /usr/local/gopath/pkg/mod/github.com/henson/proxypool@v0.0.0-20191224115608-13ffa479b44c/api/api.go:29 +0x118 net/http.HandlerFunc.ServeHTTP(0xb1caa0, 0xbc7660, 0xc0006128c0, 0xc000349c00) /usr/local/go/src/net/http/server.go:2007 +0x44 net/http.(ServeMux).ServeHTTP(0xc000063d00, 0xbc7660, 0xc0006128c0, 0xc000349c00) /usr/local/go/src/net/http/server.go:2387 +0x1bd net/http.serverHandler.ServeHTTP(0xc0000d82a0, 0xbc7660, 0xc0006128c0, 0xc000349c00) /usr/local/go/src/net/http/server.go:2802 +0xa4 net/http.(conn).serve(0xc000641680, 0xbc8ca0, 0xc000596c00) /usr/local/go/src/net/http/server.go:1890 +0x875 created by net/http.(Server).Serve /usr/local/go/src/net/http/server.go:2927 +0x38e

sndnvaps commented 4 years ago

你得说明一下,什么操作导致的panic啊。。 你这光说错误,我怎么知道你的原因呢。。 如果是运行的时候报错,建议换一个版本的go 我使用的是版本是 go 1.13.1 win/386 @liliang8858