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

Fix performance and bug #867

Merged
merged 3 commits into from
Jul 15, 2019

Conversation

masahiro331
Copy link
Contributor

@masahiro331 masahiro331 commented Jul 9, 2019

If this Pull Request is work in progress, Add a prefix of “[WIP]” in the title.

What did you implement:

  1. Fix performance.

Fix the performance degradation introduced by this PR.
#857

This PR needs to update go.mod after vulsio/goval-dictionary#73 is merged.

  1. Fix bug
[Jul  9 19:24:18]  INFO [localhost] : 0 CVEs are detected with Library
[Jul  9 19:24:18]  INFO [localhost] OVAL is fresh: redhat 6.5-x86_64
2019/07/09 19:24:18 http: panic serving 127.0.0.1:55532: runtime error: index out of range
goroutine 154 [running]:
net/http.(*conn).serve.func1(0xc000860000)
	/usr/local/Cellar/go/1.12.4/libexec/src/net/http/server.go:1769 +0x139
panic(0x51c10e0, 0x64e2980)
	/usr/local/Cellar/go/1.12.4/libexec/src/runtime/panic.go:522 +0x1b5
github.com/future-architect/vuls/oval.RedHatBase.convertToDistroAdvisory(0x53b9ac4, 0x6, 0xc001072790, 0xc0008baf90)
	/Users/01025026/work/go/src/github.com/future-architect/vuls/oval/redhat.go:157 +0x29a
github.com/future-architect/vuls/oval.RedHatBase.update(0x53b9ac4, 0x6, 0xc000876000, 0x0, 0x0, 0xc000e920f0, 0x21, 0x0, 0x0, 0x0, ...)
	/Users/01025026/work/go/src/github.com/future-architect/vuls/oval/redhat.go:136 +0x75a
github.com/future-architect/vuls/oval.RedHatBase.FillWithOval(0x53b9ac4, 0x6, 0x57be840, 0xc0006557d0, 0xc000876000, 0x510f301, 0x0, 0x0)
	/Users/01025026/work/go/src/github.com/future-architect/vuls/oval/redhat.go:51 +0x17d
github.com/future-architect/vuls/report.FillWithOval(0x57be840, 0xc0006557d0, 0xc000876000, 0xc001074680, 0x2, 0x2)
	/Users/01025026/work/go/src/github.com/future-architect/vuls/report/report.go:336 +0x44c
github.com/future-architect/vuls/report.FillCveInfo(0x57c6660, 0xc00073e500, 0x57be840, 0xc0006557d0, 0x0, 0x0, 0x0, 0x0, 0xc000876000, 0x65332e0, ...)
	/Users/01025026/work/go/src/github.com/future-architect/vuls/report/report.go:175 +0x277
github.com/future-architect/vuls/server.VulsHandler.ServeHTTP(0x57a3b80, 0xc000714460, 0xc000864000)
	/Users/01025026/work/go/src/github.com/future-architect/vuls/server/server.go:91 +0x94e
net/http.(*ServeMux).ServeHTTP(0x6513a20, 0x57a3b80, 0xc000714460, 0xc000864000)
	/usr/local/Cellar/go/1.12.4/libexec/src/net/http/server.go:2375 +0x1d6
net/http.serverHandler.ServeHTTP(0xc0000f7790, 0x57a3b80, 0xc000714460, 0xc000864000)
	/usr/local/Cellar/go/1.12.4/libexec/src/net/http/server.go:2774 +0xa8
net/http.(*conn).serve(0xc000860000, 0x57ac800, 0xc00051d600)
	/usr/local/Cellar/go/1.12.4/libexec/src/net/http/server.go:1878 +0x851
created by net/http.(*Server).Serve
	/usr/local/Cellar/go/1.12.4/libexec/src/net/http/server.go:2884 +0x2f4

Inserting redhat's oval with --no-detail option to db will panic the Title because it does not exist.
https://github.com/future-architect/vuls/blob/master/oval/redhat.go#L155-L158

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested?

We have tested server mode.
OVAL used was redhat, ubuntu, oracle, amazon

Checklist:

  • Write tests
  • Write documentation
  • Check that there aren't other open pull requests for the same issue/feature
  • Format your source code by make fmt
  • Pass the test by make test
  • Provide verification config / commands
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: NO

go.sum Outdated
@@ -263,6 +263,8 @@ github.com/kotakanbe/go-pingscanner v0.1.0 h1:VG4/9l0i8WeToXclj7bIGoAZAu7a07Z3qm
github.com/kotakanbe/go-pingscanner v0.1.0/go.mod h1:/761QZzuZFcfN8h/1QuawUA+pKukp3qcNj5mxJCOiAk=
github.com/kotakanbe/goval-dictionary v0.1.4 h1:X0B9fCb9ogaVvHfJCvJwyOLNWiAHdkDD9tQA3GtuLGw=
github.com/kotakanbe/goval-dictionary v0.1.4/go.mod h1:VupP39J8370MdBkmvQQVmuYf98VrcQzhiGo+UiNW4rs=
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go mod tidy, please

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry. fixed.

@knqyf263 knqyf263 changed the title [WIP] Fix performance and bug Fix performance and bug Jul 15, 2019
@knqyf263 knqyf263 merged commit a977533 into future-architect:master Jul 15, 2019
@knqyf263
Copy link
Contributor

👍

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

Successfully merging this pull request may close these issues.

2 participants