Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(vpn): use unbuffered channel in speaker#15863

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ethanndickson merged 1 commit intomainfromethan/tunnel-flake
Dec 16, 2024

Conversation

ethanndickson
Copy link
Member

@ethanndicksonethanndickson commentedDec 13, 2024
edited
Loading

Closescoder/internal#253.

The Tunnel closing mechanism encounters a race if the passedio.ReadWriteCloser is shared between the Tunnel and the Manager, specifically if the closing of the Conn by one causes a read fail on the other.

The sequence of events during the flakey tests is as follows:

  1. Tunnel sends stop response
  2. Tunnel closes sendch
  3. net.Pipe gets closed by Tunnel'ssendLoop ending
  4. Manager'sserdes reads the response successfully and passes it to the speaker via therecvCh.
  5. The speaker tries to deliver the response via the message'srespCh. TherespCh is buffered so this is non-blocking.
  6. TherecvLoopDone channel is closed by therecvCh getting closed (by failing to read from the closed conn)
  7. unaryRPC is finally scheduled to run, where both of these conditions in a select block are ready, and so whether or not the response is returned is random.
[...]case <-s.recvLoopDone:logger.Debug(s.ctx, "recvLoopDone while waiting for response")return resp, io.ErrUnexpectedEOFcase resp = <-respCh:logger.Debug(s.ctx, "got response", slog.F("resp", resp))return resp, nil

The solution is to therefore make therespCh unbuffered. That way, it's not possible for therecvLoopDone channel to be closed until therespCh is read from.

@ethanndicksonGraphite App
Copy link
MemberAuthor

This stack of pull requests is managed byGraphite. Learn more aboutstacking.

@ethanndicksonethanndicksonforce-pushed theethan/tunnel-flake branch 4 times, most recently from5b19e5e to7fb2642CompareDecember 16, 2024 05:53
@ethanndicksonethanndickson changed the titlefix: use independent pipes in vpn tunnel testsfix(vpn): use unbuffered channel in speakerDec 16, 2024
@ethanndicksonethanndickson marked this pull request as ready for reviewDecember 16, 2024 06:03
@ethanndicksonethanndickson merged commit67fdbe5 intomainDec 16, 2024
43 checks passed
@ethanndicksonethanndickson deleted the ethan/tunnel-flake branchDecember 16, 2024 08:48
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsDec 16, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@spikecurtisspikecurtisspikecurtis approved these changes

Assignees

@ethanndicksonethanndickson

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

test flake: vpn TestTunnel_StartStop
2 participants
@ethanndickson@spikecurtis

[8]ページ先頭

©2009-2025 Movatter.jp