Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
Add additional race condition protections for client/server goroutine interactions in the statsd and carbon receiver ListenAndServer test.
new logic introduces a timeout/tick loop to test for message reception prior to closing the listening server side connection. The new logic addresses the race when the server connection is closed prior to the recv buffer being read in the goroutine reading from the connection buffer, but giving the test enough time to let the server goroutine read from the connection buffer before the main test process request connection close.
The encoded timeout is generous at 10 seconds, but the tick loop fires every 500 msecs so I expect in production wait loop will break out successfully in a couple of ticks, unless I've misinterpreted the underlying problem.
This is a 2nd effort to fix bug: #10916
Testing:
The production race condition is hard to hit in local testing (races are fun!), but I was able to observe the race locally and was able to re-create it synthetically by introducing long waits in the server goroutine.
Documentation:
No documentation