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

Dawid Weiss commented on LUCENE-9670:
-------------------------------------

Hi Mike. I think I see a potential cause of the problem... We have this in our 
javadoc gradle script:
{code}
    outputFile.withOutputStream { output ->
      result = project.exec {
        executable javadocCmd

        standardOutput = output
        errorOutput = output

        args += [ "@${optionsFile}" ]

        // -J flags can't be passed via options file... (an error "javadoc: 
error - invalid flag: -J-Xmx512m" occurs.)
        args += [ "-J-Xmx512m" ]
        // force locale to be "en_US" (fix for: 
https://bugs.openjdk.java.net/browse/JDK-8222793)
        args += [ "-J-Duser.language=en", "-J-Duser.country=US" ]

        ignoreExitValue true
      }
    } 
{code}

Note the bit which opens an output stream and then launches a sub-process. I 
looked at gradle sources and the stack trace leads to a stream-piping code that 
fails on a *write* - this means it read something from the subprocess but can't 
pipe into the output. So my theory is that the subprocess completed just fine 
but gradle closed the output stream before the piping code got closed. Why it's 
not closed before the call to exec returns - I've no idea... looks like a bug.

What you could try to do is to add a pause (1 second?) after exec and before 
the stream is closed... See if this changes anything.

> gradle precommit sometimes fails with "IOException: stream closed" from 
> javadoc in nightly benchmarks
> -----------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-9670
>                 URL: https://issues.apache.org/jira/browse/LUCENE-9670
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Michael McCandless
>            Priority: Major
>
> I recently added tracking how long {{gradle precommit}} takes each night so 
> we can track slowdowns over time.
> But it sometimes fails with:
> {noformat}
> > Task :lucene:join:renderJavadoc FAILED
> Could not read standard output of command '/opt/jdk-15.0.1/bin/javadoc'.
> java.io.IOException: Stream Closed
>         at java.base/java.io.FileOutputStream.writeBytes(Native Method)
>         at java.base/java.io.FileOutputStream.write(FileOutputStream.java:347)
>         at 
> java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81)
>         at 
> java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142)
>         at 
> org.gradle.process.internal.streams.ExecOutputHandleRunner.forwardContent(ExecOutputHandleRunner.java:68)
>         at 
> org.gradle.process.internal.streams.ExecOutputHandleRunner.run(ExecOutputHandleRunner.java:53)
>         at 
> org.gradle.internal.operations.CurrentBuildOperationPreservingRunnable.run(CurrentBuildOperationPreservingRunnable.java:42)
>         at 
> org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
>         at 
> org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
>         at 
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
>         at 
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
>         at 
> org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
>         at java.base/java.lang.Thread.run(Thread.java:832) {noformat}
> I'm not sure why ... when I run {{./gradlew precommit}} interactively it 
> doesn't seem to do this.
> The nightly tool is quite simple – it just launches a sub-process using 
> {{os.system}}: (first to {{git clean}} then to run {{./gradlew precommit)}}: 
> https://github.com/mikemccand/luceneutil/blob/master/src/python/runNightlyGradleTestPrecommit.py



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to