Repository navigation
Stabilize Windows named pipe sockets (WCOW) - #526
Merged
Merged
Conversation
…EOF handling - NamedPipeSocket: timeout-aware streams on top of the async channel, honor connect timeout, report isConnected/isBound, no-op half-close - NamedPipeJniSocket: mutable soTimeout shared with source/sink, pass connect timeout through - NamedPipeUtils: throw IOException/SocketTimeoutException instead of RuntimeException, classify read/write errors at the call site, drain cancelled overlapped I/O before returning Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… timeout - pass a JNA Memory buffer instead of byte[] to overlapped ReadFile/WriteFile: JNA only keeps a byte[] valid during the call, so pending I/O read from or wrote into released memory - pass the OVERLAPPED as raw pointer: passing the Structure made JNA write its stale fields (Internal=STATUS_PENDING) back before GetOverlappedResult, causing ERROR_IO_INCOMPLETE (bWait=false) or a hang (bWait=true) - map soTimeout 0 to INFINITE for WaitForSingleObject instead of "don't wait" - resume partial writes at the current offset instead of resending from 0 - keep data of a read that completed right before a timeout cancellation - add in-process pipe tests forcing pending reads/writes and soTimeout Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oss timeouts - NamedPipeSocketFactory: choose NamedPipeSocket (CHANNEL, default) or NamedPipeJniSocket (JNI) via constructor, system property de.gesellix.docker.client.filesocket.namedpipe.impl or env var DOCKER_FILESOCKET_NAMEDPIPE_IMPL - NamedPipeSocket: read into an internal buffer and keep a timed-out read pending for the next read() instead of losing its data, writing into the caller's array later, or running two reads concurrently; fail cleanly when not connected or closed - NamedPipeJniSocket: isBound/shutdownOutput/shutdownInput like NamedPipeSocket - NamedPipeImplementationsTest: the same in-process pipe scenarios for both implementations, replacing the JNI-only tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WaitForSingleObject can't be interrupted from Java, so a read without soTimeout ignored Thread.interrupt(). docker-remote-api-client relies on interrupts (runInterruptible) to cancel blocking attach/exec frame reads, which made attach (interactive) hang with the JNI implementation on WCOW. Wait in 100ms slices, and cancel and drain the I/O when interrupted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gesellix
added a commit
to gesellix/docker-client
that referenced
this pull request
Dec 3, 2026
Named pipe fixes for WCOW (docker-client/docker-filesocket#526) and UnixSocket timeout/half-close delegation (docker-client/docker-filesocket#527). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gesellix
added a commit
to docker-client/docker-remote-api-client
that referenced
this pull request
Dec 3, 2026
Named pipe fixes for WCOW (docker-client/docker-filesocket#526) and UnixSocket timeout/half-close delegation (docker-client/docker-filesocket#527). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gesellix
added a commit
to docker-client/docker-remote-api-client
that referenced
this pull request
Dec 3, 2026
Named pipe fixes for WCOW (docker-client/docker-filesocket#526) and UnixSocket timeout/half-close delegation (docker-client/docker-filesocket#527). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gesellix
added a commit
to gesellix/docker-client
that referenced
this pull request
Dec 3, 2026
Named pipe fixes for WCOW (docker-client/docker-filesocket#526) and UnixSocket timeout/half-close delegation (docker-client/docker-filesocket#527). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes hangs, lost data and broken timeouts in the Windows named pipe transport, and makes both named pipe implementations selectable so they can be compared.
Changes
NamedPipeSocket(default; built onAsynchronousFileChannel)setSoTimeout()is honored now; the previousChannels.newInputStream()blocked without any timeout.read()continues with it. No data gets lost, the caller's array isn't written to afterread()returned, and there's never more than one read in flight.isConnected()/isBound()report the actual state;shutdownOutput()/shutdownInput()are no-ops (named pipes have no half-close). OkHttp needs this to finish writing to hijacked attach/exec streams.connect()honors the caller's timeout (0 = infinite) and throwsSocketTimeoutException.NamedPipeJniSocket/NamedPipeUtils(overlapped I/O via JNA)Memorybuffers. JNA only keeps abyte[]valid during the call itself, so pending I/O read from or wrote into released memory.OVERLAPPEDstruct is passed as a raw pointer. Passing theStructurelet JNA write its stale fields (Internal=STATUS_PENDING) back beforeGetOverlappedResult, which causedERROR_IO_INCOMPLETEor hangs.docker-remote-api-clientcancels blocking attach/exec reads viaThread.interrupt(); a nativeWaitForSingleObjectignored that and hung.IOException/SocketTimeoutExceptioninstead ofRuntimeException; same Socket overrides asNamedPipeSocket.NamedPipeSocketFactoryde.gesellix.docker.client.filesocket.namedpipe.impl(channel|jni) or env varDOCKER_FILESOCKET_NAMEDPIPE_IMPL. Default stayschannel.Tests
NamedPipeImplementationsTest: the same scenarios against both implementations, using an in-process pipe server (no Docker needed): pending reads/writes with data verification, read timeout without data loss, half-close, interrupt, close during a pending read.attach (interactive),exec (interactive),http over named pipe,diff(together with test fixes in docker-client).🤖 Generated with Claude Code