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

snapshot cache: fix heartbeat panic #579

Merged
merged 3 commits into from
Aug 8, 2022

Conversation

danielhochman
Copy link
Contributor

@danielhochman danielhochman commented Aug 2, 2022

Encountering a panic where the snapshot has not been set yet but the cache is heartbeating and a watch comes in. Add a check on the snapshot existence for the node to avoid the panic.

Added a test to verify.

2022-08-02T15:18:27.520Z       DEBUG   v3/simple.go:391        open watch 1 for type.googleapis.com/envoy.service.runtime.v3.Runtime[rtds] from nodeID "test-cluster", version ""
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0xb3a163]

goroutine 7 [running]:
github.com/envoyproxy/go-control-plane/pkg/cache/v3.(*snapshotCache).sendHeartbeats(0xc0003a2180, {0xf26d10, 0xc000040030}, {0xc000496754, 0xc})
       /go/src/github.com/envoyproxy/go-control-plane/pkg/cache/v3/simple.go:193 +0x163
github.com/envoyproxy/go-control-plane/pkg/cache/v3.NewSnapshotCacheWithHeartbeating.func1()
       /go/src/github.com/envoyproxy/go-control-plane/pkg/cache/v3/simple.go:176 +0x154
created by github.com/envoyproxy/go-control-plane/pkg/cache/v3.NewSnapshotCacheWithHeartbeating
       /go/src/github.com/envoyproxy/go-control-plane/pkg/cache/v3/simple.go:167 +0x1a9

Signed-off-by: Daniel Hochman <danielhochman@users.noreply.github.com>
Signed-off-by: Daniel Hochman <danielhochman@users.noreply.github.com>
Copy link
Member

@sunjayBhatia sunjayBhatia left a comment

Choose a reason for hiding this comment

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

LGTM

probably never hit this case in other tests since we use a longer heartbeat interval and set a snapshot before it triggers!

Signed-off-by: Daniel Hochman <danielhochman@users.noreply.github.com>
@alecholmez alecholmez merged commit 7857518 into envoyproxy:main Aug 8, 2022
@danielhochman danielhochman deleted the fix-panic-heartbeat branch August 8, 2022 15:51
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.

None yet

4 participants