Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic: runtime error: invalid memory address or nil pointer dereference when scan CentOS5.5 #58

Closed
k1LoW opened this issue May 13, 2016 · 2 comments
Labels

Comments

@k1LoW
Copy link

k1LoW commented May 13, 2016

Error pattern

[May 13 17:45:10]  INFO [xxxxxxx:22] (331/331) Scanned zlib-devel-1.2.3-3 -> 1.2.3-7.el5 : []
[May 13 17:45:10]  INFO [xxxxxxx:22] Fetching CVE details...
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x4137087]

goroutine 3774 [running]:
panic(0x4727140, 0xc820010170)
        /Users/k1low/.anyenv/envs/goenv/versions/1.6.2/src/runtime/panic.go:481 +0x3e6
github.com/future-architect/vuls/cveapi.cvedictClient.httpGet.func1(0x0, 0x0)
        /Users/k1low/go/src/github.com/future-architect/vuls/cveapi/cve_client.go:137 +0x3f7
github.com/cenkalti/backoff.RetryNotify(0xc820ab1c20, 0x5362da8, 0xc820939380, 0x490ad20, 0x0, 0x0)
        /Users/k1low/go/src/github.com/cenkalti/backoff/retry.go:32 +0x4d
github.com/future-architect/vuls/cveapi.cvedictClient.httpGet(0x485b0b0, 0x15, 0xc820442f89, 0xd, 0xc820ab1bc0, 0x28, 0xc820342120, 0xc8203422a0)
        /Users/k1low/go/src/github.com/future-architect/vuls/cveapi/cve_client.go:144 +0x192
github.com/future-architect/vuls/cveapi.cvedictClient.FetchCveDetails.func2()
        /Users/k1low/go/src/github.com/future-architect/vuls/cveapi/cve_client.go:95 +0x303
github.com/future-architect/vuls/util.GenWorkers.func1(0xc820342420)
        /Users/k1low/go/src/github.com/future-architect/vuls/util/util.go:35 +0x60
created by github.com/future-architect/vuls/util.GenWorkers
        /Users/k1low/go/src/github.com/future-architect/vuls/util/util.go:37 +0x6d

Host: Mac OSX Yosemite
Remote host: CentOS5.5
Repeatability: Yes
Check another CentOS5.5?: No. I don't have another CentOS5.5...

Success pattern

Host: Mac OSX Yosemite
Remote host: CentOS6.6 ( Other server )

@kotakanbe kotakanbe added the bug label May 16, 2016
kotakanbe added a commit that referenced this issue May 16, 2016
…r_in_cve_client

Fix nil pointer at error handling of cve_client #58
kotakanbe added a commit that referenced this issue May 16, 2016
…r_in_cve_client

Fix error handling of httpGet in cve-client #58
@kotakanbe
Copy link
Member

Hi @k1LoW
Thanks for reporting.

The nil pointer error was fixed in above changes.
Now Vuls can print the error message instead of nil pointer.

In the above case of Centos5.5, Vuls found many CVE IDs (over 300).
Vuls request to go-cve-dictionary concurrently.
I guess that max open file error was occurred.

It's better to check open files limit of your OS.
see https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/

@k1LoW
Copy link
Author

k1LoW commented May 17, 2016

Thank you for your fix!!

I guess that max open file error was occurred.

You are right!

> launchctl limit maxfiles
        maxfiles    256            unlimited

Now Vuls can print the error message instead of nil pointer.

Result

I retry (go get -u and vuls scan).

[May 17 10:29:43]  INFO [xxxxxx:22] (331/331) Scanned zlib-devel-1.2.3-3 -> 1.2.3-7.el5 : []
[May 17 10:29:43]  INFO [xxxxxx:22] Fetching CVE details...
WARN[0933] Failed to HTTP GET. retrying in 552.330144ms seconds. err: HTTP GET error: [Get http://127.0.0.1:1323/cves/CVE-2010-2431: EOF], url: http://127.0.0.1:1323/cves/CVE-2010-2431, resp: <nil>
WARN[0933] Failed to HTTP GET. retrying in 720.254544ms seconds. err: HTTP GET error: [Get http://127.0.0.1:1323/cves/CVE-2011-2748: EOF], url: http://127.0.0.1:1323/cves/CVE-2011-2748, resp: <nil>
WARN[0933] Failed to HTTP GET. retrying in 582.280027ms seconds. err: HTTP GET error: [Get http://127.0.0.1:1323/cves/CVE-2010-3704: dial tcp 127.0.0.1:1323: socket: too many open files], url: http://127.
0.0.1:1323/cves/CVE-2010-3704, resp: <nil>
WARN[0933] Failed to HTTP GET. retrying in 468.857094ms seconds. err: HTTP GET error: [Get http://127.0.0.1:1323/cves/CVE-2012-0061: dial tcp 127.0.0.1:1323: socket: too many open files], url: http://127.
0.0.1:1323/cves/CVE-2012-0061, resp: <nil>
WARN[0933] Failed to HTTP GET. retrying in 462.318748ms seconds. err: HTTP GET error: [Get http://127.0.0.1:1323/cves/CVE-2011-0281: dial tcp 127.0.0.1:1323: socket: too many open files], url: http://127.
0.0.1:1323/cves/CVE-2011-0281, resp: <nil>

-loop....-
{"time":"2016-05-17T10:29:44+09:00","remote_ip":"127.0.0.1","method":"GET","uri":"/cves/CVE-2011-2692","status":200, "latency":3995,"latency_human":"3.995597ms","rx_bytes":0,"tx_bytes":6178}
2016/05/17 10:29:44 http: Accept error: accept tcp 127.0.0.1:1323: accept: too many open files; retrying in 10ms
2016/05/17 10:29:44 http: Accept error: accept tcp 127.0.0.1:1323: accept: too many open files; retrying in 20ms
2016/05/17 10:29:44 http: Accept error: accept tcp 127.0.0.1:1323: accept: too many open files; retrying in 40ms
2016/05/17 10:29:44 http: Accept error: accept tcp 127.0.0.1:1323: accept: too many open files; retrying in 80ms

-loop...-

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants