Skip to content

Conversation

@kzys
Copy link

@kzys kzys commented Feb 27, 2020

Issue #, if available:

#198

Description of changes:

The first commit is a benchmark to reproduce the issue. The second commit is actually fixing the issue. We are not removing signal handling channels (sigchan in setupSignals).

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Kazuyoshi Kato added 2 commits February 27, 2020 15:15
Since the cause is a process-level resource leak, running these
benchmarks in a same process
(e.g. go test -bench=BenchmarkForwardSignals) doesn't show
the difference.

Signed-off-by: Kazuyoshi Kato <[email protected]>
The "break" here only break out from the inner select statement.
The for loop is keep running and signal.Stop() won't be called.

Seems that is the cause of firecracker-microvm#198.

Signed-off-by: Kazuyoshi Kato <[email protected]>
Copy link
Contributor

@xibz xibz left a comment

Choose a reason for hiding this comment

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

Can we paste some benchmarks with the old vs fixed changes? Otherwise this looks good

@kzys
Copy link
Author

kzys commented Feb 28, 2020

Sure. Before the change (c3bc513):

% sudo DISABLE_ROOT_TESTS= ~/src/go1.14/bin/go test -run=XXX -bench=BenchmarkForwardSignalsDefault -benchtime=1x
goos: linux
goarch: amd64
pkg: github.com/firecracker-microvm/firecracker-go-sdk
BenchmarkForwardSignalsDefault-96              1        3856837117 ns/op
--- BENCH: BenchmarkForwardSignalsDefault-96
    benchmark_test.go:106: BenchmarkForwardSignalsDefault: 1
    benchmark_test.go:106: BenchmarkForwardSignalsDefault: 1
PASS
ok      github.com/firecracker-microvm/firecracker-go-sdk       24.299s
% sudo DISABLE_ROOT_TESTS= ~/src/go1.14/bin/go test -run=XXX -bench=BenchmarkForwardSignalsDisable -benchtime=1x
goos: linux
goarch: amd64
pkg: github.com/firecracker-microvm/firecracker-go-sdk
BenchmarkForwardSignalsDisable-96              1         558669169 ns/op
--- BENCH: BenchmarkForwardSignalsDisable-96
    benchmark_test.go:106: BenchmarkForwardSignalsDisable: 1
    benchmark_test.go:106: BenchmarkForwardSignalsDisable: 1
PASS
ok      github.com/firecracker-microvm/firecracker-go-sdk       1.311s

After the change (f8cf437):

% sudo DISABLE_ROOT_TESTS= ~/src/go1.14/bin/go test -run=XXX -bench=BenchmarkForwardSignalsDefault -benchtime=1x
goos: linux
goarch: amd64
pkg: github.com/firecracker-microvm/firecracker-go-sdk
BenchmarkForwardSignalsDefault-96              1         566526518 ns/op
--- BENCH: BenchmarkForwardSignalsDefault-96
    benchmark_test.go:106: BenchmarkForwardSignalsDefault: 1
    benchmark_test.go:106: BenchmarkForwardSignalsDefault: 1
PASS
ok      github.com/firecracker-microvm/firecracker-go-sdk       1.328s
% sudo DISABLE_ROOT_TESTS= ~/src/go1.14/bin/go test -run=XXX -bench=BenchmarkForwardSignalsDisable -benchtime=1x
goos: linux
goarch: amd64
pkg: github.com/firecracker-microvm/firecracker-go-sdk
BenchmarkForwardSignalsDisable-96              1         548990953 ns/op
--- BENCH: BenchmarkForwardSignalsDisable-96
    benchmark_test.go:106: BenchmarkForwardSignalsDisable: 1
    benchmark_test.go:106: BenchmarkForwardSignalsDisable: 1
PASS
ok      github.com/firecracker-microvm/firecracker-go-sdk       1.257s

Copy link
Contributor

@mxpv mxpv left a comment

Choose a reason for hiding this comment

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

LGTM

@kzys kzys merged commit 5f3b54f into firecracker-microvm:master Mar 2, 2020
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.

3 participants