-
Notifications
You must be signed in to change notification settings - Fork 82
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
startProcess: dup2: invalid argument (Bad file descriptor)
on macOS
#247
Comments
@bgamari do you have any thoughts on what could have changed in process that could trigger this kind of behavior? |
Adding more information:
|
@psibi, I also ran into |
@mpilgrem Thanks, not sure if we both found the same While the workaround solved majority of the failing tests, I'm still getting that issue as part of two integration test failure for which I'm yet to find any proper solution. |
@snoyberg, apologies for not seeing this until now. It seems like there are a few issues being reported on this ticket which are likely due to different causes. @mpilgrem, could you open separate tickets, ideally with minimal reproducers, for the distinct issues you have seen? #214 indeed sounds quite relevant here but without being able to reproduce the issue it is very hard to say what is going on. |
I believe the |
@bgamari's patch fixes the dup2 based failures in the Stack codebase. The only remaining issue is the
|
I will close this then. |
Thanks for the confirmation, @psibi. Can you open a new issue to track the |
I am not sure if this is a
process-1.6.14.0
issue, but I think it may well be, because:process-1.6.9.0
(supplied in resolverlts-17.15
) toprocess-1.6.14.0
;package-1.6.9.0
topackage-1.6.12.0
, the identified problems do not occur; anddup2
and macOS connections. May I call on the expertise of @bgamari ?By way of background, I am trying (here commercialhaskell/stack#5736) to get the existing
stack
project to (a) build using GHC 9.0.2 rather than withlts-17.15
(GHC 8.10.4) and (b) pass the CI oncommercialhaskell/stack
. I am usinglts-19.7
with an extra dependency onprocess-1.6.14.0
(because of the macOS bugs that it fixed). (If I uselts-19.7
with an extra dependency onprocess-1.6.12.0
there are no simlar problems.)It (
stack
, built that way), and the CI, works fine on Windows.It (
stack
) also seems to work fine on macOS; my test is 'Can I buildstack
withstack
?'.However, on
macos-latest
(macOS 11.6.6) the CI fails - specifically, during the run of the testing executablestack-integration-test
. The testing also fails in the same way on a local macOS 10.15.5 machine. The error messages are (reformated for clarity):I am pretty sure the error is arising in a
RIO.Process.runProcess_
inStack.Build.Execute.getSetupExe
. The relevant extract being theelse ...
branch below.None of the above source code has been changed in moving from GHC 8.10.4 to GHC 9.0.2, so I am at a loss to understand why errors are now being thrown on macOS. I don't know the position on other Unix-like operating systems - I don't have access to a linux machine and the linux CI fails for other reasons (something to do wtih 'alpine' and 'docker' images).
My own knowledge is very limited - I am a Windows user with access also to a macOS machine - and a little knowledge is a dangerous thing, but I am assuming that the error message I am seeing ultimately comes from
child_failed(pipe, "dup2")
incbits/posix/fork_exec.c setup_std_handle_fork
. Tracing back from that line in the source code, I reachdo_spawn_fork
and thendo_spawn
inrunProcess.c
. If I understand correctly, indo_spawn
,do_spawn_posix
must have returned-2
and it has then trieddo_spawn_fork
. Tracing further back, I then reachrunInteractiveProcess
inrunProcess.c
and, finally,System.Process.Posix.c_runInteractiveProcess
. That is the boundary of my own understanding.The text was updated successfully, but these errors were encountered: