Skip to content

Fix flaky TestHostForwarding by receiving client payload before responding#6756

Merged
amartinezfayo merged 2 commits into
spiffe:mainfrom
amartinezfayo:fix-flaky-TestHostForwarding
Mar 17, 2026
Merged

Fix flaky TestHostForwarding by receiving client payload before responding#6756
amartinezfayo merged 2 commits into
spiffe:mainfrom
amartinezfayo:fix-flaky-TestHostForwarding

Conversation

@amartinezfayo
Copy link
Copy Markdown
Member

The ForwardedHostV1Plugin used in TestHostForwarding was sending a response and returning without first calling stream.Recv() to consume the client's payload. This created a race condition: if the server closed its side of the stream before the client's stream.Send() completed, the send would return io.EOF, which V1.streamError converts to "plugin closed stream unexpectedly".

An example of a failure in the test can be found here: https://github.com/spiffe/spire/actions/runs/23202195179/job/67427532224#step:5:209

The fix adds a stream.Recv() call in the plugin handler before sending the response, synchronizing the bidirectional stream protocol so the server waits for the client's payload before responding.

…onding

Signed-off-by: Agustín Martínez Fayó <amartinezfayo@gmail.com>
@amartinezfayo amartinezfayo modified the milestone: 1.15.0 Mar 17, 2026
@amartinezfayo amartinezfayo enabled auto-merge March 17, 2026 18:43
@amartinezfayo amartinezfayo added this pull request to the merge queue Mar 17, 2026
Merged via the queue into spiffe:main with commit ccb26f0 Mar 17, 2026
50 checks passed
@MarcosDY MarcosDY modified the milestones: 1.15.0, 1.14.4 Mar 19, 2026
iamP1 added a commit to iamP1/spire that referenced this pull request Mar 20, 2026
…onding (spiffe#6756)

Signed-off-by: Agustín Martínez Fayó <amartinezfayo@gmail.com>
Co-authored-by: Sorin Dumitru <sorin@returnze.ro>Signed-off-by: iamP1 <nhegde@redhat.com>
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.

3 participants