You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pipeBytes'1 Property test fails with native implementation #51
After discussion, the current cause of the bug appears to be how the process is being cloned in the ghc runtime. It is likely that ghc RTS threads implemented using pthreads, is using clone call with flags that do not copy over the file descriptors.
With this assumption the sequence of steps that leads to the error are these -
Parent process creates a pipe
File descriptors are updated in green thread 1 (GT 1)
Parent process "clones" a child process on GT 1
Child process is moved to GT 2 because of scheduling
GT2 does not have fd structures of pipe created in GT 1. This is related to how threads have been implemented in GHC RTS.
Child process tries to close fds that do not exist
This is an intermittent issue because sometimes step 4 does not happen. This error also does not occur on using the process package because the library clones parent and child process using a c ffi function, somehow GHC makes sure process created through ffi stays on the same GT. Another point that validates the above cause is that tests pass when configured to run with 1 thread only.
Activity
twitu commentedon Jun 13, 2022
Different test failures are related to a common issue with closing file descriptors. Below are logs or a failed run and a successful run.
Failed
Passed
All cases are failing in the child process at the output action step where the stdout pipe's (from child to parent) parent fd is failing to close.
twitu commentedon Jul 28, 2022
After discussion, the current cause of the bug appears to be how the process is being cloned in the ghc runtime. It is likely that ghc RTS threads implemented using pthreads, is using clone call with flags that do not copy over the file descriptors.
With this assumption the sequence of steps that leads to the error are these -
This is an intermittent issue because sometimes step 4 does not happen. This error also does not occur on using the
processpackage because the library clones parent and child process using a c ffi function, somehow GHC makes sure process created through ffi stays on the same GT. Another point that validates the above cause is that tests pass when configured to run with 1 thread only.[-]`pipeBytes'1` Property test fails[/-][+]`pipeBytes'1` Property test fails with native implementation[/+]