Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flush outgoing content before sending EOF message #43

Merged
merged 2 commits into from Apr 26, 2017

Conversation

simonferquel
Copy link
Contributor

Fixes #42

This adds a Flush() method on win32File, and calls it on CloseWrite() just before sending the 0-length EOF message.

This makes sure that the 0-length message is not collapsed into the previous message, and that functions like io.Copy() do correctly receive an io.EOF error and completes instead of hanging.

The first commit introduces a test that hangs, the second fixes the issue (and makes the test pass)

This was identified, qualified and fixed by @dgageot and me

This exhibit a deadlock we see sometimes when using docker cli connected
to a daemon through a named pipe with some data in the input stream (ie:
`echo "hello" | docker run ... `)

The problem seems to be that the EOF 0-length message is collapsed with
the previous message, if the buffer associated with the named pipe is
not previously flushed

Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
This forces any pending data to be sent to the remote party before
emitting the 0-length EOF message, to make sure it appears as a seperate
message.

This fixes the "TestEchoWithMessaging" test

Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
@thaJeztah
Copy link
Contributor

ping @jstarks PTAL 👍

@dgageot
Copy link

dgageot commented Mar 21, 2017

@jstarks @thaJeztah This is really important for Docker for Windows. Please TAL

@thaJeztah
Copy link
Contributor

/cc @jhowardmsft

dgageot added a commit to dgageot/docker that referenced this pull request Mar 21, 2017
Fixes moby#31922

Vendor a fork of Microsoft/go-winio that has this
PR (microsoft/go-winio#43)
merged


Signed-off-by: David Gageot <david@gageot.net>
vdemeester pushed a commit to vdemeester/moby that referenced this pull request Mar 21, 2017
Fixes moby#31922

Vendor a fork of Microsoft/go-winio that has this
PR (microsoft/go-winio#43)
merged


Signed-off-by: David Gageot <david@gageot.net>
@vdemeester
Copy link

@jstarks @jhowardmsft @darrenstahlmsft we need your review on this 👼 Right now we use a patch version of this to fix some issues with docker4windows but it would be way better if it was fixed upstream 👼 🙏

@lowenna lowenna merged commit f3b1913 into microsoft:master Apr 26, 2017
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.

EOF message not received with message mode named pipes
5 participants