-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Deno.run with piped stdout gets stuck in specific scenarios #4568
Comments
I can't repeat it. |
Managed to narrow it down to only happening when the file that is being opened is stored on an NTFS drive - this is really weird. It's not happening on macOS for me either, just on Linux + file.txt on NTFS drive. If the file.txt is on ext4 its fine. I'll try on Windows and report back. This might be a weird NTFS driver bug on Linux though - had some of those before. |
Checked on windows - not happening there. I'll close this and reopen if I have any more exact information about what is going on. |
Ok I have a reliable reproduction, on macOS now:
const proc = Deno.run({
cmd: ["deno", "doc", "lib.deno.d.ts", "--json", "--reload"],
stdout: "piped",
stderr: "piped"
});
const status = await proc.status();
|
@lucacasonato does error happen if you |
Everything works as expected when I add |
This happens when the stdout is bigger than (?) 64KiB, consider: const p = Deno.run({
// this will work in any case:
// cmd: [ 'curl', '-s', 'https://deno.land' ], // 4KB
// this will work only if stdout is drained below:
cmd: [ 'curl', '-s', 'https://en.wikipedia.org/wiki/Deno_(software)' ], // 79KB
stdout: 'piped',
stderr: 'piped'
})
console.log('here 1')
// await p.output() // drain the stdout here
console.log('here 1.1')
await p.stderrOutput()
console.log('here 1.2')
const { code } = await p.status()
console.log('here 2, code: ' + code) You have to uncomment the |
I just ran into this again on the registry. It is a very annoying bug because it is so not logical. I think many people have and will run into it. I also ran into it for doc.deno.land. We should really address this one soon. |
@lucacasonato I think I did run into some form of it: #7208 (comment) but can't explain it... |
@lucacasonato I get the same issue when the sub process is asking for stdin (similar to what i mentioned before), it just hangs on the |
encountered same issue again! here is my work around: const proc = Deno.run({ cmd, stderr: 'piped', stdout: 'piped' });
const [ stderr, stdout, status ] = await Promise.all([ proc.stderrOutput(), proc.output(), proc.status() ]); |
Still happening on latest canary |
So after further investigation I think this works as it should.
@ebebbington this should no longer be the case, calling |
@bartlomieju ok cool thanks, I’ll just mention that this issue doesn’t affect me anymore I guess as I moved to another solution but good to hear it is addressed |
This was very surprising to encounter, and I don't know what I would have done if I hadn't found this issue! FWIW the examples of Deno.run that I was working off of (incorrectly) read |
Is this still happening, or has the deadlock been fixed? |
This is still happening (just ran into it using The surprising part is that it does not happen on "small" outputs, only on big ones, which is a bit destabilizing (and can result in seemingly arbitrary hangs when other commands succeed), reason for which I stumbled on this thread in the first place... |
This doesn't happen with the new subprocess API ( |
Reproduction
await proc.status()
.The text was updated successfully, but these errors were encountered: