[ 
https://issues.apache.org/jira/browse/LUCENE-6530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14576418#comment-14576418
 ] 

Uwe Schindler commented on LUCENE-6530:
---------------------------------------

I opened this issue because of lots of code duplication with this thread pumper 
class and I had the feeling that the ProcessBuilder.Redirect functionality of 
Java 7 internally pumps to System.out and System.err - but this is not fully 
true; it just looks the same because it works on a lower level: For simple 
cases the "inheriting process descriptors" is perfectly fine. So the code that 
executes {{iptables}} in Solr (to block ports and "emulate broken network 
connections") does not produce any output, and if output is generated - it's an 
error and the exit code != 0 (this is checked now on Solr's iptables test 
support).

The JRE Crush test was just cleaned up, but it still consumes the streams and 
pumps them (but only if VERBOSE=true).

I would with that Java would have a {{ProcessBuilder$Redirect.to(OutputStream 
stream)}} static method... Because this would simplify a lot. And also if Java 
would allow to pass {{java.nio.files.Path}} to {{ProcessBuilder$Redirect}} 
instead of {{java.io.File}} which violates forbidden-apis (for in/out/err and 
CWD). The current "pumpers" are just stupid. Instead of having only an 
InputStream to *consume* stdout of process it would be nice to pass an open 
OutputStream to the Redirect class and the process *actively pushs* its output 
to the given stream, so no pumper thread would be needed (it could internally 
be one, depending on operating system)...

> Use Java 7 ProcessBuilder.inheritIO() instead of own ThreadPumper
> -----------------------------------------------------------------
>
>                 Key: LUCENE-6530
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6530
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>            Priority: Minor
>              Labels: Java7
>             Fix For: Trunk, 5.3
>
>         Attachments: LUCENE-6530.patch, LUCENE-6530.patch
>
>
> In some tests wie spawn separate processes (TestIndexWriterOnJRECrash and 
> Solr's IPTables). To capture stdin/stdout/stderr we spawn several threads 
> that pump those to stdout/stderr.
> Since Java 7 there is ProcessBuilder.inheritIO() that does this for us 
> without any additional threads. We should use this instead. Fix is easy, just 
> remove some stuff :-)
> I did the same already for my Codec classloader deadlock test, so this is 
> just a followup for the other tests.
> Patch is attached and can be committed to trunk and 5.x.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to