Skip to content

Conversation

@twz123
Copy link
Contributor

@twz123 twz123 commented Dec 19, 2025

On some platforms, dialing 127.0.0.1:0 doesn't fail immediately but rather blocks until it times out. This leads to test failures because the leak detector identifies stray goroutines.

Even if the tests don't need the dial to succeed, create a random listener and use that as resolved address.

RELEASE NOTES: none

@codecov
Copy link

codecov bot commented Dec 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.40%. Comparing base (319a0fa) to head (b6734d9).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8782      +/-   ##
==========================================
+ Coverage   83.33%   83.40%   +0.07%     
==========================================
  Files         418      418              
  Lines       32910    32910              
==========================================
+ Hits        27424    27450      +26     
+ Misses       4088     4070      -18     
+ Partials     1398     1390       -8     

see 35 files with indirect coverage changes

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

@twz123 twz123 force-pushed the channelz-test-direct-error branch from 5e7db39 to b46a30e Compare December 19, 2025 16:32
@mbissa mbissa assigned mbissa and eshitachandwani and unassigned mbissa Dec 24, 2025
@eshitachandwani eshitachandwani added this to the 1.79 Release milestone Dec 31, 2025
@eshitachandwani
Copy link
Member

Instead of failing unconditionally , would a better way be to create a net.Listener and and pass it's address like :

lis, err := net.Listen("tcp", "localhost:0")
if err != nil {
    t.Fatalf("Failed to listen: %v", err)
}
defer lis.Close()

And then pass the address as

	resolvedAddrs := []resolver.Address{{Addr: lis.Addr().String(), ServerName: "grpclb.server"}}

On some platforms, dialing 127.0.0.1:0 doesn't fail immediately but
rather blocks until it times out. This leads to test failures because
the leak detector identifies stray goroutines.

Even if the tests don't need the dial to succeed, create a random
listener and use that as resolved address.

Signed-off-by: Tom Wieczorek <twieczorek@mirantis.com>
@twz123 twz123 force-pushed the channelz-test-direct-error branch from ce50ee3 to b6734d9 Compare January 5, 2026 10:29
@twz123
Copy link
Contributor Author

twz123 commented Jan 5, 2026

Instead of failing unconditionally , would a better way be to create a net.Listener and and pass it's address like :

lis, err := net.Listen("tcp", "localhost:0")
if err != nil {
    t.Fatalf("Failed to listen: %v", err)
}
defer lis.Close()

And then pass the address as

	resolvedAddrs := []resolver.Address{{Addr: lis.Addr().String(), ServerName: "grpclb.server"}}

Right. I've tried this, and, funnily enough, when I allow the tests to dial, I encounter leak detector errors due to #8655. However, if I merge #8666 into this PR, the leak detector errors disappear.

I'll mark this one as draft until #8655 has been sorted out.

@twz123 twz123 marked this pull request as draft January 5, 2026 10:30
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.

3 participants