Skip to content

Read environ handshake before starting input reader - #21

Merged
mattn merged 1 commit into
masterfrom
fix-client-handshake
Jul 10, 2026
Merged

Read environ handshake before starting input reader#21
mattn merged 1 commit into
masterfrom
fix-client-handshake

Conversation

@mattn

@mattn mattn commented Jul 10, 2026

Copy link
Copy Markdown
Owner

The input reader goroutine decoded from the shared gob.Decoder while the main goroutine also decoded the initial environ handshake from it. The two concurrent Decode calls race and the handshake []string could be consumed by the reader goroutine, corrupting the protocol. The goroutine also clobbered the shared err variable.

Decode the environ handshake before launching the reader goroutine, and use a local err inside the goroutine.

@mattn
mattn merged commit 5d026d3 into master Jul 10, 2026
2 checks passed
@mattn
mattn deleted the fix-client-handshake branch July 10, 2026 08:04
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.

1 participant