- AuthorPosts
- September 22, 2016 at 10:55 pm #21074atnakParticipant
Settings are as follows:
External Tool Properties:
[x] Use Output Bar
[x] Close on ExitInput
[Document]
[ ] Add EOFOutput
[Replace Document]
Encoding: [System Default (932, shift_jis)
Standard Error: [Display as Output Bar]Description of the problem:
EmEditor hangs when running an External Tool that reads from stdin and writes to stdout, if the read and write are performed batches that exceed a certain number of bytes (4000~5000).
Because the problem is hard to provide a minimalistic reproducible example for, I’m going to speculate on what’s going on.
Speculation: The problem appears to occur if the External Tool writes, before reading from stdin, more bytes to stdout than EmEditor has allotted to the pipe buffer. It is likely the result of a deadlock that occurs because EmEditor is either blocked while waiting on the External Tool to finish, or blocked attempting to write to a full output pipe, without consuming the input pipe. (a.l.a. https://blogs.msdn.microsoft.com/oldnewthing/20110707-00/?p=10223)
As it stands, the problem does not occur if the External Tool reads from and writes to stdin and stdout in smaller batches.
Example:
On my system, I can reproduce the problem if I create a document containing around 5000 characters then call the below (java) External Tool.
public class InOut { public static void main(String[] args) throws Exception { for (int i = 0; i < 5000; i++) { System.out.write('x'); } } }
When EmEditor hangs, the java program is stopped inside
System.out.write()
. - AuthorPosts
- You must be logged in to reply to this topic.