driver/kubernetes: close exec-stream pipes when the stream ends#3966
Open
pgimalac wants to merge 1 commit into
Open
driver/kubernetes: close exec-stream pipes when the stream ends#3966pgimalac wants to merge 1 commit into
pgimalac wants to merge 1 commit into
Conversation
pgimalac
force-pushed
the
pgimalac/kubernetes-execconn-close-on-stream-end
branch
2 times, most recently
from
July 22, 2026 15:45
bcca1d6 to
6d0a21d
Compare
crazy-max
reviewed
Jul 22, 2026
Member
Author
@crazy-max yeah fair, I figured it was a catch-all for both (in particular considering the last message is about kubernetes), but I'll update the description. |
Signed-off-by: Pierre Gimalac <23154723+pgimalac@users.noreply.github.com>
pgimalac
force-pushed
the
pgimalac/kubernetes-execconn-close-on-stream-end
branch
from
July 22, 2026 16:15
6d0a21d to
c4b1789
Compare
pgimalac
marked this pull request as ready for review
July 22, 2026 17:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Ensure the far ends of the command exec pipes are properly closed when the exec stream ends (due to an error or not), to prevent infinite hangs in reader/writer.
Currently, if the remote kubernetes executor gets killed, buildx just hangs forever because it tries to read from pipes which are never closed. With this change, the pipes are immediately closed when
StreamWithContextfinishes, and readers/writers are unblocked.Refs #556.
Added some unit tests to highlight the fix.
Repro / testing
Setup:
Create a Dockerfile which takes some time, eg.:
and build it:
docker buildx build --builder kindbuilder --progress=plain -f Dockerfile .Wait for the log to show that it's running the sleep step, then open a new shell and kill it:
The
buildcommand will then hang forever (in particular won't finish after 2 minutes).Now build
cmd/buildxfrom this PR, and re-run the same steps using thisbuildxbinary instead ofdocker buildx, you should observe that the build command logserr="io: read/write on closed pipe"when the pod is killed, and fails with the following error: