Skip to content

Conversation

@Pranjali-2501
Copy link
Contributor

Fixes #8703

Description

This PR fixes the data race in TestChildPolicyChangeOnConfigUpdate.

Changes

  • Isolated Policy: Instead of overwriting the global pick_first policy (and triggering a race condition via Unregister), the test now registers a unique custom stub policy named test_pick_first.
  • TypedStruct Configuration: Updated the management server resource update to use v3xdsxdstypepb.TypedStructand specify the custom type.googleapis.com/test_pick_first policy via TypeURL.

RELEASE NOTES: N/A

@Pranjali-2501 Pranjali-2501 added this to the 1.78 Release milestone Nov 29, 2025
@codecov
Copy link

codecov bot commented Nov 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.34%. Comparing base (69769dc) to head (04a79ee).
⚠️ Report is 11 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8730      +/-   ##
==========================================
+ Coverage   83.16%   83.34%   +0.17%     
==========================================
  Files         419      418       -1     
  Lines       32450    32425      -25     
==========================================
+ Hits        26988    27024      +36     
+ Misses       4068     4016      -52     
+ Partials     1394     1385       -9     

see 36 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@easwars easwars left a comment

Choose a reason for hiding this comment

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

Please ensure that you can run this test 10K or 100K times on Forge before merging this. You could use the instructions here to pull in this change into a piper client and run the test with the race detector turned on (10K/100K times). Thanks.

@easwars easwars assigned Pranjali-2501 and unassigned easwars Dec 1, 2025
Copy link
Contributor

@easwars easwars left a comment

Choose a reason for hiding this comment

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

Looks mostly good. Just some minor nits.


ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()

Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Please avoid making unnecessary whitespace changes. Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

},
UpdateClientConnState: func(bd *stub.BalancerData, ccs balancer.ClientConnState) error {
name := pfBuilder.Name()
name := customLBPolicy
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this local variable? Can't this be inlined?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think I see why this might be required. This could be because of the use of atomic.Pointer[string]. Could you instead change this to use atomic.Value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

select {
case <-ctx.Done():
t.Fatalf("Timeout waiting for successful RPC after policy update.")
return
Copy link
Contributor

Choose a reason for hiding this comment

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

This return statement will never be hit. So, it can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Comment on lines 1250 to 1251
_, err := client.EmptyCall(ctx, &testpb.Empty{})
if err == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be on a single line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@easwars easwars assigned Pranjali-2501 and unassigned easwars Dec 10, 2025
@Pranjali-2501 Pranjali-2501 merged commit 0800ec7 into grpc:master Dec 11, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test: 10/100k: Test/ChildPolicyChangeOnConfigUpdate

2 participants