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

add test for: Windows output redirection trouble #11727

Closed
tkelman opened this issue Jun 16, 2015 · 25 comments
Closed

add test for: Windows output redirection trouble #11727

tkelman opened this issue Jun 16, 2015 · 25 comments
Labels
help wanted Indicates that a maintainer wants help on an issue or pull request io Involving the I/O subsystem: libuv, read, write, etc. needs tests Unit tests are required for this change system:windows Affects only Windows upstream The issue is with an upstream dependency, e.g. LLVM

Comments

@tkelman
Copy link
Contributor

tkelman commented Jun 16, 2015

Steps to reproduce (this is in Cygwin cross-compile, I'll also check in MSYS2 to see if it's any different there):

$ git clone git://git.kitenet.net/moreutils
$ make clean && make testall1 | moreutils/ts -s

Full output is at https://gist.github.com/tkelman/4d9717ae288c637a6432 - note the jl_uv_writecb() ERROR: invalid argument EINVAL during the later bootstrap stages which seems to be non-fatal, but when running the tests it is fatal. ts is a perl script, but we have similar messages on the Windows buildbots where I think python is driving the process and logging: http://buildbot.e.ip.saba.us:8010/builders/package_win8.1-x64/builds/864/steps/make/logs/stdio

This has been happening for quite a while, I think @staticfloat and I hit this error the last time we tried to enable running the tests on the Windows buildbots so this is probably a blocker to doing that.

versioninfo:

Julia Version 0.4.0-dev+5413
Commit fecadcb* (2015-06-16 17:23 UTC)
Platform Info:
  System: Windows (i686-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-2630QM CPU @ 2.00GHz
  WORD_SIZE: 32
  BLAS: libopenblas (DYNAMIC_ARCH NO_AFFINITY Nehalem)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

edit: minimal reproduction:

$ (usr/bin/julia -e "println('a')" && usr/bin/julia -e "println('b')") | cat
a
bERROR: write: invalid argument (EINVAL)
 in uv_write at stream.jl:1024
...
@tkelman tkelman added system:windows Affects only Windows io Involving the I/O subsystem: libuv, read, write, etc. labels Jun 16, 2015
@staticfloat
Copy link
Member

Grrr, yes. I remember this. I'm pretty sure it has something to do with the way libuv handles cygwin pipes on windows.

@vtjnash
Copy link
Member

vtjnash commented Jul 21, 2015

is this still broken for you? i currently can't seem to reproduce it on master on my machine.

@tkelman
Copy link
Contributor Author

tkelman commented Jul 21, 2015

Yes, at 298231e this is still happening. Cygwin64 build of win64 Julia (last month was win32 but looked the same), windows 7. I have MARCH = x86-64 in my Make.user but I'd be surprised if that made any difference.

I do recall this being picky about not always happening in an incremental build, are you running the exact command verbatim including the make clean?

tkelman added a commit that referenced this issue Sep 14, 2015
This reverts commit dbacfa2.
This broke on the Windows buildbots due to #11727, ref
#13069 (comment)
tkelman added a commit that referenced this issue Sep 16, 2015
this time with a JULIA_ENABLE_DOCBUILD flag to allow disabling this step on the buildbots
where #11727 causes trouble on windows

ref #13069
tkelman added a commit that referenced this issue Sep 22, 2015
this time with a JULIA_ENABLE_DOCBUILD flag to allow disabling this step on the buildbots
where #11727 causes trouble on windows

ref #13069
skumagai pushed a commit to skumagai/julia that referenced this issue Oct 9, 2015
this time with a JULIA_ENABLE_DOCBUILD flag to allow disabling this step on the buildbots
where JuliaLang#11727 causes trouble on windows

ref JuliaLang#13069
@vtjnash vtjnash added the upstream The issue is with an upstream dependency, e.g. LLVM label Nov 24, 2015
@vtjnash
Copy link
Member

vtjnash commented Nov 24, 2015

This seems to be an implementation error with the implementation of UV_HANDLE_EMULATE_IOCP in libuv commit libuv/libuv@54982a2 . In particular, overlapped->hEvent was not initialized prior to ReadFile / WriteFile per https://msdn.microsoft.com/en-us/library/windows/desktop/ms686358(v=vs.85).aspx, so it is still NULL when passed to RegisterWaitForSingleObject, which thus returns ERROR_INVALID_PARAMETER.

This happens here because the NamedPipe handle is getting passed to multiple libuv (Julia) processes and apparently only one process may make an IOCompletionPort for a NamedPipe (not documented, although the restrictions given are pretty troubling -- for example, the handle should not be duplicated, shared, or passed to CreateProcess: https://msdn.microsoft.com/en-us/library/windows/desktop/aa363862(v=vs.85).aspx), forcing libuv to use the fallback emulation code. (partially related, this appear to also indirectly be caused by a resource leak in the Windows kernel where the OS is failing to destroy uv_loop.iocp after program termination, but it is not valid for destruction prior to program termination because we can't close the stdio objects that we've associated with it).

@eschnett
Copy link
Contributor

I've just encountered this error when building the Julia release-0.4 branch with Cygwin. Does this mean that building with Cygwin is currently broken? If there's no immediate prospect of having this corrected, should the build instructions be updated to warn about this?

@vtjnash
Copy link
Member

vtjnash commented Mar 14, 2016

you just can't build with output going to a pipe

@ihnorton
Copy link
Member

Additional comments from @vtjnash about this issue:

  1. the code to initialize overlapped->hEvent is missing from pipe.c
  2. the parallel code in tty.c (from which the pipe.c code was copied) is correct

@StefanKarpinski StefanKarpinski added the help wanted Indicates that a maintainer wants help on an issue or pull request label Sep 10, 2016
@StefanKarpinski StefanKarpinski added this to the 0.5.x milestone Sep 10, 2016
@vtjnash vtjnash removed their assignment Sep 11, 2016
@tkelman
Copy link
Contributor Author

tkelman commented Sep 11, 2016

^ care to comment or explain there? this needs doing to allow running windows tests on buildbot. does @ihnorton or anyone else know how?

don't just unassign yourself from an important issue you know how to fix without any explanation.

@StefanKarpinski StefanKarpinski added help wanted Indicates that a maintainer wants help on an issue or pull request and removed help wanted Indicates that a maintainer wants help on an issue or pull request labels Oct 27, 2016
@tkelman tkelman mentioned this issue Dec 8, 2016
4 tasks
@staticfloat
Copy link
Member

@tkelman can you please verify that this PR fixes the problem on windows for you: https://github.com/JuliaLang/libuv/pull/44

In my testing, it seems to have worked, but I'd like to be doubly sure. :)

@tkelman
Copy link
Contributor Author

tkelman commented Jun 1, 2017

It can start running tests, but cmdlineargs is freezing.

@staticfloat
Copy link
Member

staticfloat commented Jun 4, 2017 via email

@tkelman
Copy link
Contributor Author

tkelman commented Jun 4, 2017

it hasn't been the last test in a while afaik

@staticfloat
Copy link
Member

staticfloat commented Jun 4, 2017

Really? Looking at the latest linux64 and osx64 testing runs on the buildbot, it's listed as the last.

EDIT: I guess I should specify; it's at least the last to print out. I suppose that's not necessarily the last to be scheduled, but in this case I don't think the distinction matters much.

@tkelman
Copy link
Contributor Author

tkelman commented Jun 5, 2017

run in a single worker, it definitely isn't the last to start

@staticfloat
Copy link
Member

Ah, I see, so you're saying that running the tests in a single worker freezes on cmdlineargs?

@tkelman
Copy link
Contributor Author

tkelman commented Jun 7, 2017

It's looking like it's an unrelated problem. make testall1 finishes running enums but never finishes with the next test which is cmdlineargs. Though there was an assertion failure before that for older commits, trying to figure out what fixed that.

@tkelman
Copy link
Contributor Author

tkelman commented Jun 13, 2017

the freeze in the cmdlineargs tests looks like it was caused by 94acb6f

vtjnash added a commit that referenced this issue Aug 18, 2017
fixes UV_HANDLE_EMULATE_IOCP handling for Windows pipes

close #11727
vtjnash added a commit that referenced this issue Aug 25, 2017
fixes UV_HANDLE_EMULATE_IOCP handling for Windows pipes

close #11727
@tkelman tkelman changed the title Windows output redirection trouble add test for: Windows output redirection trouble Aug 27, 2017
@tkelman tkelman reopened this Aug 27, 2017
@tkelman tkelman added the needs tests Unit tests are required for this change label Aug 27, 2017
@vtjnash
Copy link
Member

vtjnash commented Aug 27, 2017

upstream's problem now

@vtjnash vtjnash closed this as completed Aug 27, 2017
@tkelman
Copy link
Contributor Author

tkelman commented Aug 27, 2017

it will regress if not tested here. come on, what is so hard about following the standard policy we've always had of adding a test when you fix a bug?

@tkelman tkelman reopened this Aug 27, 2017
@vtjnash vtjnash removed their assignment Aug 30, 2017
ararslan pushed a commit that referenced this issue Sep 11, 2017
fixes UV_HANDLE_EMULATE_IOCP handling for Windows pipes

close #11727

Ref #23326
(cherry picked from commit e89d150)
@JeffBezanson JeffBezanson removed this from the 0.5.x milestone May 21, 2018
vtjnash added a commit that referenced this issue Jun 11, 2018
This issue has been fixed. We can now show docbuild output even if the build fails.
vtjnash added a commit that referenced this issue Jun 12, 2018
This issue has been fixed. We can now show docbuild output even if the build fails.
vtjnash added a commit that referenced this issue Jun 13, 2018
This issue has been fixed. We can now show docbuild output even if the build fails.
vtjnash added a commit to vtjnash/libuv that referenced this issue Jan 10, 2020
vtjnash added a commit to vtjnash/libuv that referenced this issue Jan 11, 2020
@vtjnash vtjnash closed this as completed Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Indicates that a maintainer wants help on an issue or pull request io Involving the I/O subsystem: libuv, read, write, etc. needs tests Unit tests are required for this change system:windows Affects only Windows upstream The issue is with an upstream dependency, e.g. LLVM
Projects
None yet
Development

No branches or pull requests

7 participants