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

scion/ping: wait for send go routine to terminate #4392

Merged
merged 1 commit into from
Sep 18, 2023

Conversation

oncilla
Copy link
Contributor

@oncilla oncilla commented Sep 15, 2023

Wait for the ping sender go routine to terminate before we return the stats. With bad luck, the receiver go routine receives all the replies before the sender go routine has terminated. Because only the sender go routine increments the stats.Sent count at the end, we can end up with wrong stats that claim more packets were received then sent.


This change is Reviewable

Wait for the ping sender go routine to terminate before we return the
stats. With bad luck, the receiver go routine receives all the replies
before the sender go routine has terminated. Because only the sender
go routine increments the stats.Sent count, we end up with wrong stats
that claim more packets were received then sent.
Copy link
Contributor

@matzf matzf left a comment

Choose a reason for hiding this comment

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

:lgtm:

Just to slightly expand on the description of the problem (because I had initially misunderstood this to be about spurious echo packets); the race condition is that WriteTo in the last pinger.send succeeds, but then the writer go-routine is not scheduled to increment the stats.Sent counter before these stats are returned from pinger.Ping. This only seems likely to happen with very low latency (e.g. ping localhost).

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @oncilla)

@oncilla oncilla merged commit d176fc0 into scionproto:master Sep 18, 2023
4 checks passed
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.

2 participants