Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java Heap Space Error caused by an 'Out Of Memory' Error #2272

Closed
CleanHit opened this issue Feb 25, 2020 · 5 comments
Closed

Java Heap Space Error caused by an 'Out Of Memory' Error #2272

CleanHit opened this issue Feb 25, 2020 · 5 comments

Comments

@CleanHit
Copy link

CleanHit commented Feb 25, 2020

At the end of the analyzer-result.yml file I see:

      'Gradle::app/build.gradle:':
      - timestamp: "2020-02-25T16:08:48.310903Z"
        source: "Gradle"
        message: "Resolving dependencies for 'build.gradle' failed with: BuildException:\
          \ Could not fetch model of type 'DependencyTreeModel' using Gradle distribution\
          \ 'https://services.gradle.org/distributions/gradle-5.4.1-all.zip'.\nCaused\
          \ by: LocationAwareException: Java heap space\nCaused by: OutOfMemoryError:\
          \ Java heap space"
        severity: "ERROR"
    has_issues: true

I've this setting in my global .gradle/gradle.properties file:

org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureondemand=true
org.gradle.jvmargs=-Xmx6g -XX:MaxPermSize=4096m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

I think I give enough memory to Gradle or do I need to set the setting above in some other gradle.properties file? If I understood it correctly then, it fails to resolve the dependencies for 'build.gradle' because of that OutOfMemoryError.

I'm using:

  • Fedora 31 OS
  • OpenJDK 12
  • gradle -v output:
------------------------------------------------------------
Gradle 6.2
------------------------------------------------------------

Build time:   2020-02-17 08:32:01 UTC
Revision:     61d3320259a1a0d31519bf208eb13741679a742f

Kotlin:       1.3.61
Groovy:       2.5.8
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          12.0.2 ("Oracle Corporation" 12.0.2+13)
OS:           Linux 5.5.5-200.fc31.x86_64 amd64
@CleanHit
Copy link
Author

CleanHit commented Feb 25, 2020

It looks like using the ort analyze ... command downloads and uses gradle-5.4.1-all during the whole process instead of mine Gradle installation. So, maybe I need to put my changes into the gradle.properties file of the downloaded Gradle v5.4.1. What is the location of this file after it has been downloaded by the tool?

@sschuberth
Copy link
Member

The ORT Analyzer uses the version of Gradle which has been configured to be used by the project being analyzed, via the Gradle wrapper. That is, in contrast to Maven, where you usually use the globally installed mvn command, Gradle projects usually specify by themselves which
version of Gradle they are supposed to be built with, similar to like they declare usual build dependencies. So from that perspective everything is fine, and Gradle downloads its distributions to ~/.gradle/wrapper/dists.

@sschuberth
Copy link
Member

This post has some more memory setting hints for Gradle 5.

@CleanHit
Copy link
Author

CleanHit commented Feb 25, 2020

This post has some more memory setting hints for Gradle 5.

Thanks, it looks like I'll have to edit the gradle.properties file to set the needed Java memory parameters of the scanned project. I'll do it tomorrow and report the results.

@sschuberth just for my understanding. The OSS Review Toolkit uses the Gradle environment settings of the scanned project and that is why I need to change the gradle.properties file of the project, if I want to solve the OutOfMemoryError issue, right?

@CleanHit
Copy link
Author

This post has some more memory setting hints for Gradle 5.

Adding and modifying (for my needs) the suggested line in this comment to the scanned project gradle.properties file solved the OutOfMemoryError issue. This has bumped the size of my analyzer-result.yml file from ~404KB to ~581,7MB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants