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

Backport of Fix panicky xDS test flakes into release/1.15.x #16310

Conversation

hc-github-team-consul-core
Copy link
Collaborator

Backport

This PR is auto-generated from #16305 to be assessed for backporting due to the inclusion of the label backport/1.15.

The below text is copied from the body of the original PR.


Description

I'm seeing a bunch of panics in some flaky testing code in our xDS package. The relevant stack traces that come up time and again seem to mostly be on ARM (I'm assuming that this is due to some sort of slowness in the test runs that are accentuating race conditions due to additional qemu translation? 🤷):

goroutine 353 [running]:
github.com/hashicorp/consul/agent/xds.(*TestADSDeltaStream).Context(0x400009ff48?)
	<autogenerated>:1
github.com/hashicorp/consul/agent/xds.(*Server).DeltaAggregatedResources(0x4001581620, {0x2998370, 0x0})
	/home/circleci/project/agent/xds/delta.go:50 +0x4c
github.com/hashicorp/consul/agent/xds.newTestServerDeltaScenario.func3()
	/home/circleci/project/agent/xds/xds_protocol_helpers_test.go:197 +0x38
created by github.com/hashicorp/consul/agent/xds.newTestServerDeltaScenario
	/home/circleci/project/agent/xds/xds_protocol_helpers_test.go:196 +0x408

Notice the DeltaAggregatedResources(0x4001581620, {0x2998370, 0x0}) -- the first argument should be the pointer address to the xds server itself, the second is the first argument of the DeltaAggregatedResources function (stream ADSDeltaStream), which, since it's an interface is a tuple of the type information and then the actual pointer to the underlying type, which is nil.

We seem to be niling the argument that gets passed there in our test helpers while cleaning up after a test run, which, if any requests are in flight will pretty much cause any of our handler code to panic and the tests to abort (hence the ridiculous amount of flake).

Really we should probably fix the testing code so it doesn't nil something that's often unconditionally dereferenced and also potentially used in a multithreaded context (I wouldn't be surprised if there were still panics due to only nil checking once and using it later in the function), but this is a simple attempt to at least make the tests fail less often, and I'd prefer this for now than to potentially heavily refactor the testing code (I'm also not sure what tests rely on the nil behavior of the stream).

Edit: Introduced a boolean guard in the test code itself that should hopefully fix the panics since we were still hitting them due to this being multithreaded. Doesn't appear like anything relies on the nil, so hopefully that should be fine.

PR Checklist

  • updated test coverage
  • external facing docs updated
  • not a security concern

Overview of commits

@hc-github-team-consul-core hc-github-team-consul-core force-pushed the backport/xds-test-flaky-fixes/surely-exact-finch branch from b137e60 to 78ff7e1 Compare February 17, 2023 19:08
@hc-github-team-consul-core hc-github-team-consul-core force-pushed the backport/xds-test-flaky-fixes/surely-exact-finch branch from 93beec4 to bfd03ef Compare February 17, 2023 19:08
@github-actions github-actions bot added the theme/envoy/xds Related to Envoy support label Feb 17, 2023
Copy link
Collaborator

Choose a reason for hiding this comment

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

Auto approved Consul Bot automated PR

@hc-github-team-consul-core hc-github-team-consul-core merged commit 3cba165 into release/1.15.x Feb 17, 2023
@hc-github-team-consul-core hc-github-team-consul-core deleted the backport/xds-test-flaky-fixes/surely-exact-finch branch February 17, 2023 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/envoy/xds Related to Envoy support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants