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

os: Windows: reading data from stdin hangs in 1.9 #22207

Closed
mappu opened this issue Oct 11, 2017 · 8 comments
Closed

os: Windows: reading data from stdin hangs in 1.9 #22207

mappu opened this issue Oct 11, 2017 · 8 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Milestone

Comments

@mappu
Copy link

mappu commented Oct 11, 2017

Hi,

What version of Go are you using (go version)?

go1.9.1 windows/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

Windows 10 amd64

What did you do?

I have a program that

  • uses github.com/Microsoft/go-winio to listen on a named pipe (maybe that's relevant, i don't know)
  • uses CGO, using Cygwin's distribution of mingw-w64 gcc, but not targeting Cygwin, nor running under it
  • expects to read some data from stdin shortly after it launches

What did you expect to see?

The Go program should receive data on stdin, then go about its business, as expected.
This works as expected on Go 1.8.4.

What did you see instead?

The Go program hangs at 0% CPU usage.
From the behaviour of the program i infer it is blocked on reading from stdin.
It hangs probably 5/10 attempts when launched via a Qt application, but interestingly it hangs 0/10 attempts when launched from cmd.exe.

This issue is almost identical to #22024, but my case is a bit different, because

  • I am not targeting cygwin, nor running under cygwin
  • The hang is intermittent (maybe a race condition?)
  • I do not yet have a short reproducer
@ianlancetaylor ianlancetaylor changed the title Reading data from stdin hangs after upgrading 1.8.4->1.9 os: Windows: reading data from stdin hangs in 1.9 Oct 11, 2017
@ianlancetaylor ianlancetaylor added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows labels Oct 11, 2017
@ianlancetaylor ianlancetaylor added this to the Go1.10 milestone Oct 11, 2017
@ianlancetaylor
Copy link
Contributor

CC @alexbrainman

@ghost
Copy link

ghost commented Oct 11, 2017

https://github.com/Microsoft/go-winio

In the final paragraph of the Readme.md file is a citation to another Go named pipe implementation.

@as
Copy link
Contributor

as commented Oct 11, 2017

The issue seems to be converging on how Go (and perhaps the new poller) interacts with named pipes. Cygwin uses named pipes as a conduit for data that would flow through anonymous pipes between two processes under certain conditions mentioned in #22024

@as
Copy link
Contributor

as commented Oct 11, 2017

@forskning The difference is that Microsoft package seems to support additional functionality.

On Windows, named pipes can transfer data in message mode or byte mode. The original npipe didn't support message mode. Cygwin on the other hand, uses message mode.

@mappu

In lieu of a short reproducible snippet, Are you able to share any information on how the pipe is created using that package? Specifically, the mode used (message or byte), and whether this affects your ability to reproduce the issue in your application.

@alexbrainman
Copy link
Member

@mappu it is difficult to suggest anything without reproducible example. Even non reproducible example would be better than what you have provided - vague description of what you think your program does.

Alex

@gopherbot
Copy link

Change https://golang.org/cl/69871 mentions this issue: internal/poll: only call SetFileCompletionNotificationModes for sockets

@alexbrainman
Copy link
Member

@mappu can you, please, try https://golang.org/cl/69871 to see if it fixes your problem?

Thank you

Alex

@gopherbot
Copy link

Change https://golang.org/cl/70990 mentions this issue: [release-branch.go1.9] internal/poll: only call SetFileCompletionNotificationModes for sockets

gopherbot pushed a commit that referenced this issue Oct 25, 2017
…ficationModes for sockets

CL 36799 made SetFileCompletionNotificationModes to be called for
file handles. I don't think it is correct. Revert that change.

Fixes #22024
Fixes #22207

Change-Id: I26260e8a727131cffbf60958d79eca2457495554
Reviewed-on: https://go-review.googlesource.com/69871
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-on: https://go-review.googlesource.com/70990
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
@golang golang locked and limited conversation to collaborators Oct 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Projects
None yet
Development

No branches or pull requests

5 participants