marytts / gradle-marytts-voicebuilding-plugin

A replacement for the legacy VoiceImportTools in MaryTTS
http://mary.dfki.de/
GNU General Public License v3.0
16 stars 12 forks source link

gradle build fails for "Too many open files in system" #109

Closed fnunnari closed 5 years ago

fnunnari commented 5 years ago

I have a project with a custom build.gradle:

plugins {
    id "de.dfki.mary.voicebuilding-legacy"
}

marytts {
    voice {
        name = 'testownvoice'
        gender = 'male'
        language = 'it'
    }
}

wav {
    srcDir = layout.buildDirectory.dir('wav_orig')
}

And I have a submodule for: buildSrc gradle-marytts-voicebuilding-plugin [05ce486eed83]

> cat .gitmodules 
[submodule "buildSrc"]
    path = buildSrc
    url = https://github.com/marytts/gradle-marytts-voicebuilding-plugin.git

Under build, I manually created and filled directories text, wav_orig, and lab.

When executing, the first time, I get an error about Could not resolve all dependencies for configuration On the second run, I get an error about Too many open files in system !!! Maybe too many parallel tests on the input files? But my training set has so far only 23 files.

System details: OS: MacOS 10.11.6 java version "1.8.0_192"

Output details.

After first run:

Starting a Gradle Daemon, 6 stopped Daemons could not be reused, use --status for details

> Task :buildSrc:groovydoc
Trying to override old definition of task fileScanner

> Task :buildSrc:test

Gradle suite > Gradle test > de.dfki.mary.voicebuilding.BasePluginFunctionalTest.testTasks[8](generateVoiceConfig, true) FAILED
    org.gradle.testkit.runner.UnexpectedBuildFailure: Unexpected build execution failure in /var/folders/3d/gfndpym570x6bmml87jd4c1c0000gp/T/groovy-generated-1935825986224460648-tmpdir with arguments [testGenerateVoiceConfig]

    Output:

    FAILURE: Build failed with an exception.

    * What went wrong:
    A problem occurred configuring root project 'groovy-generated-1935825986224460648-tmpdir'.
    > Could not resolve all dependencies for configuration ':classpath'.
       > Could not open cache module-metadata.bin (/private/var/folders/3d/gfndpym570x6bmml87jd4c1c0000gp/T/.gradle-test-kit-fanu01/caches/modules-2/metadata-2.63/module-metadata.bin).

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    * Get more help at https://help.gradle.org

    BUILD FAILED in 0s
        at org.gradle.testkit.runner.internal.DefaultGradleRunner$1.execute(DefaultGradleRunner.java:237)
        at org.gradle.testkit.runner.internal.DefaultGradleRunner$1.execute(DefaultGradleRunner.java:234)
        at org.gradle.testkit.runner.internal.DefaultGradleRunner.run(DefaultGradleRunner.java:298)
        at org.gradle.testkit.runner.internal.DefaultGradleRunner.build(DefaultGradleRunner.java:234)
        at org.gradle.testkit.runner.internal.DefaultGradleRunner$build$2.call(Unknown Source)
        at de.dfki.mary.voicebuilding.BasePluginFunctionalTest.testTasks(BasePluginFunctionalTest.groovy:70)

29 tests completed, 1 failed, 4 skipped

> Task :buildSrc:test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':buildSrc:test'.

On the second run:

> Task :buildSrc:test

Gradle suite > Gradle test > de.dfki.mary.voicebuilding.BasePluginFunctionalTest.testTasks[9](generateServiceLoader, true) FAILED
    org.gradle.testkit.runner.UnexpectedBuildFailure: Unexpected build execution failure in /var/folders/3d/gfndpym570x6bmml87jd4c1c0000gp/T/groovy-generated-8913268779932751686-tmpdir with arguments [testGenerateServiceLoader]

    Output:

    FAILURE: Build failed with an exception.

    * What went wrong:
    java.io.FileNotFoundException: /private/var/folders/3d/gfndpym570x6bmml87jd4c1c0000gp/T/groovy-generated-8913268779932751686-tmpdir/gradle.properties (Too many open files in system)
    > /private/var/folders/3d/gfndpym570x6bmml87jd4c1c0000gp/T/groovy-generated-8913268779932751686-tmpdir/gradle.properties (Too many open files in system)

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    * Get more help at https://help.gradle.org

    BUILD FAILED in 0s
        at org.gradle.testkit.runner.internal.DefaultGradleRunner$1.execute(DefaultGradleRunner.java:237)
        at org.gradle.testkit.runner.internal.DefaultGradleRunner$1.execute(DefaultGradleRunner.java:234)
        at org.gradle.testkit.runner.internal.DefaultGradleRunner.run(DefaultGradleRunner.java:298)
        at org.gradle.testkit.runner.internal.DefaultGradleRunner.build(DefaultGradleRunner.java:234)
        at org.gradle.testkit.runner.internal.DefaultGradleRunner$build$5.call(Unknown Source)
        at de.dfki.mary.voicebuilding.BasePluginFunctionalTest.testTasks(BasePluginFunctionalTest.groovy:70)

30 tests completed, 1 failed, 4 skipped

> Task :buildSrc:test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':buildSrc:test'.
psibre commented 5 years ago

I've experienced similar issues on Mac OSX. In general, it's a side-effect of the Gradle Worker API not releasing resources. Technically, one solution would be to reboot -- "solving the problem once and for all!"

Personally, I've raised the limits on my Macs, following guidelines such as this: https://www.macobserver.com/tips/deep-dive/evade-macos-many-open-files-error-pushing-limits/

But YMMV.

fnunnari commented 5 years ago

Solved via Terminal command lines.

Check your current limits:

launchctl limit maxfiles

Set the new limits:

sudo launchctl limit maxfiles 50000 200000

Then, no more Too many open files error.

psibre commented 5 years ago

Great!

For the record, this shouldn't normally happen -- it's a side-effect of the Gradle daemon crashing too many times without a reboot.

hmijail commented 5 years ago

@psibre , you mentioned "it's a side-effect of the Gradle Worker API not releasing resources". What exactly did you mean with that? Like it's something known about the API? Or just like something that might happen because of buggy external code? If it's the first option, I'd be grateful for any pointer.

I'm asking because we are seeing gradle processes dying during our build because of "too many files open" in the latest Macbooks (bumping into the JVM max of 10240 files), while older Macbooks work correctly (~8k open files); and I'm trying to understand how can this happen.

hmijail commented 5 years ago

(to be clear, with "our build" I meant another project, unrelated to marytts)

psibre commented 5 years ago

@hmijail First of all, I would ensure that you're using the latest version of Gradle. If problems persist on some Macs, but not others, and are also not reproducible on Linux systems, I would compare the launchctl limit maxfiles settings for the different systems. Or whatever the current way of doing this on recent macOS versions is -- this discussion was related to issues on El Capitan.

PeterKieu commented 3 years ago

Perfect! I got this often when using Netbeans/Intellj on Mac Big sur ARM M1. First, I even think that the error comes from Apple Silicon SoC. You saved my day. Thank you much indeed @fnunnari