Sunday, 15 February 2015

java - I/O completion ports and stdout processing -



java - I/O completion ports and stdout processing -

i'm using i/o completion ports process management library (yes, there's reason this). can find source i'm talking here: https://github.com/jcommon/process/blob/master/src/main/java/jcommon/process/platform/win32/win32processlauncher.java (take @ lines 559 , 1137 -- yes, class needs refactored , cleaned up).

i'm launching kid process , using named pipes (not anonymous pipes b/c need asynchronous, overlapped readfile()/writefile()) in order process kid process' stdout , stderr. working. in test, launch 1,000 concurrent processes , monitor output, ensuring emit proper information. typically either 1,000 work fine or 998 of them, leaving couple have problems.

those couple of processes showing not messages beingness received. know message beingness output, thread processing getqueuedcompletionstatus() process returns read error_broken_pipe.

the expected behavior os (or c libs) flush remaining bytes on stdout buffer upon process exit. expect bytes queued iocp before getting broken pipe error. instead, bytes seem disappear , read completes error_broken_pipe -- in code causes initiate teardown kid process.

i wrote simple application test , figure out behavior (https://github.com/jcommon/process/blob/master/src/test/c/stdout-1.c). application disables buffering on stdout writes should flushed immediately. using programme in tests yields same issues launching "cmd.exe /c echo hi". , @ rate, shouldn't application (or os?) flush remaining bytes on stdout when process exits?

the source in java, using direct-mapped jna, should easy c/c++ engineers follow.

thanks help can provide!

are sure broken pipe error isn't occurring non 0 iosize? if iosize not 0 should process info read noting file closed.

my c++ code ignores error_broken_pipe , error_handle_eof , waits either next read effort fail 1 of above errors or current read finish 0 bytes read. code in question works files , pipes , i've never seen problem describe when running kind of tests describe.

java jna iocp

No comments:

Post a Comment