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

src/pipe-args.js hangs when cml is called from child_process.exec on macOS #982

Closed
0x2b3bfa0 opened this issue Apr 21, 2022 · 1 comment · Fixed by #983
Closed

src/pipe-args.js hangs when cml is called from child_process.exec on macOS #982

0x2b3bfa0 opened this issue Apr 21, 2022 · 1 comment · Fixed by #983
Assignees
Labels
bug Something isn't working p0-critical Max priority (ASAP)

Comments

@0x2b3bfa0
Copy link
Member

0x2b3bfa0 commented Apr 21, 2022

The cursed pipe-args.js file is, again1 producing esoteric issues on kernels other than Linux: now it hangs forever on macOS when using child_process.exec to run cml --version on iterative/setup-cml#60. 🐇🕳️

$ npm install --global @dvcorg/[email protected]
$ node -e "require('child_process').exec('cml --version', console.log)"

cml/bin/cml.js

Line 85 in 25747f6

.commandDir('./cml', { exclude: /\.test\.js$/ })

pipeArgs.load('binary');

nbytes = fs.readSync(0, buffer, 0, BUFSIZE, null);

cml/src/pipe-args.js

Lines 28 to 30 in 25747f6

if (err.code === 'EAGAIN') {
if (process.platform === 'darwin') {
continue;

Calling fs.readSync throws EAGAIN when there is no data in the standard input, causing an infinite loop in macOS. A similar bug affects Windows, where reading from standard input with no data just hangs readSync forever.

Footnotes

  1. https://github.com/iterative/cml/pull/732#issue-1004203281

@0x2b3bfa0 0x2b3bfa0 self-assigned this Apr 21, 2022
@0x2b3bfa0 0x2b3bfa0 added bug Something isn't working p0-critical Max priority (ASAP) labels Apr 21, 2022
@0x2b3bfa0
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p0-critical Max priority (ASAP)
Projects
None yet
1 participant