-
Notifications
You must be signed in to change notification settings - Fork 29.5k
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
Surprising I/O behaviour on Windows #4697
Comments
/cc @nodejs/platform-windows |
Thanks for reporting this issue, @cpitclaudel . If you were able to provide a simple test case that exposes this issue, that would be helpful. In any case, I'll put this on my queue of issues to investigate further. |
@orangemocha It's very tricky: I don't use Windows in general, and I have no experience with Node. However, if you use Emacs, then this is the smallest I could get on node.js' side:
;; This hangs on Windows (works fine on Linux)
(let ((process (start-process "bug" nil "node" "C:/blackhole.js")))
(process-send-string process (make-string 4097 ?a)))
;; This works fine on both platforms:
(let ((process (start-process "bug" nil "node" "C:/blackhole.js")))
(dotimes (_ 25)
(process-send-string process (make-string 4096 ?a)))) |
Feel free to ask for info on the Emacs bug thread, too. Sorry I can't help much more. |
hi, this was solved/fixed ? |
This issue has been inactive for sufficiently long that it seems like perhaps it should be closed. Feel free to re-open (or leave a comment requesting that it be re-opened) if you disagree. I'm just tidying up and not acting on a super-strong opinion or anything like that. Maybe someone from @nodejs/platform-windows can confirm the bug and wants to work on this? |
I don't care much either way: I don't use Windows much. But this issue seems significant, and relatively complex — it's not clear just ignoring it is the right way to proceed. |
@cpitclaudel I'm looking at this but the backlog is long and the day is short.... |
The reason no one has looked into it is probably because the testcase depends on Emacs. If you had provided a testcase that's reproducible without third-party software then more people would be interested in looking into it. |
@seishun Yes, of course (this was pointed out earlier in the thread, too). Unfortunately, I use neither node.js nor Windows, so there's little I can do beyond reporting the issue and pointing to more competent people, as I've done :) |
Can I get this re-opened please? Steps to reproduce:
Failing
Error message:
Succeeding
|
Interestingly when running under Git for Windows Bash it works fine.
(make sure you dont have an alias for node that prefixes with |
@cpitclaudel I just found https://github.com/nodejs/node/blob/master/doc/api/process.md#a-note-on-process-io where it states And the Succeeding
I'm trying to track down a fix for the emacs/flycheck problem and it uses pipes to communicate to the spawned eslint process, stdin redirection will not work. |
Okay, I've tracked this down to eslint's problem. https://github.com/eslint/eslint/blob/master/bin/eslint.js#L63
But this fails because of the 4k buffer size limit. Hacking their code in my environment to use a copy-pasta of https://github.com/nodejs/node/blob/master/doc/api/process.md#processstdin
And it works. Can I get someone who has a clue about this give me some direction? Should I submit a PR to eslint with the above code? |
Feel free to submit a PR. It seems like the current code there had some workarounds to avoid an unrelated issue with reading stdin on macOS, so we would need to make sure the new code works cross-platform. (As an aside, it would be great if Node had a reliable way to read all of stdin synchronously and/or without needing 14 lines of code.) |
There's been no activity on this and it's not clear how/when it will progress. Keeping the issue open does not benefit anyone but we also don't want to forget about it. I've added it to a Futures project board so it doesn't get lost. |
Hi node.js folks,
I'd like to get your input on a problem that was first raised by Flycheck users on Windows, and escalated into an Emacs bug report. I originally though the problem was with Emacs, but the observed behaviour is specific to node.js.
Some context: Flycheck is a real-time linting package for Emacs; you give it instructions on how to interpret the output of your favourite linter, and it will run it in the background and highlight errors. Many JavaScript linters are programmed using node.js, so Flycheck ends up calling node.
A few weeks ago we started getting reports that Flycheck was causing Emacs to freeze on Windows. This was shortly after Flycheck started using pipes for linting (that is, it now feeds file contents to checkers via stdin, when possible). Upon further investigation it became clear that the issue was with Emacs hanging as it tried to send input to node.js; Flycheck would call Emacs Lisp's
process-send-region
with a whole buffer worth of content, and Emacs would just hang. We also noticed that sending input in small batches (less than 4kiB didn't cause the issue.We notified the Emacs folks, who came up with a fix, but the fix is essentially node.js-specific: Emacs now makes sure to never write more to a pipe than its buffer size. Eli Zaretskii, the author of that patch, explained it as follows:
We're mostly satisfied with the fix on the Emacs side, but there seem to be something strange going on on Node.js' side; is there some interest on your side to try to dig deeper into this issue?
The Emacs discussion is at https://debbugs.gnu.org/cgi/bugreport.cgi?bug=22344; it took a few messages to converge to the understanding presented above, though.
The text was updated successfully, but these errors were encountered: