Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Metabase
  3. Frequent "java.lang.OutOfMemoryError: Java heap space" errors

Frequent "java.lang.OutOfMemoryError: Java heap space" errors

Scheduled Pinned Locked Moved Solved Metabase
memory
6 Posts 4 Posters 2.9k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • jamesgallagherJ Offline
      jamesgallagherJ Offline
      jamesgallagher
      wrote on last edited by girish
      #1

      I'm getting errors about the Java heap space fairly regularly (see sample below). They appear to take the Metabase app down. I had previously pushed the memory up on <my cloudron>/#/app/d00ef8b7-e3a6-43e3-8c3c-73d822c1fded/resources to 3GB but the container doesn't appear to hit that. A quick scan of Metabase docs seems to indicate there's an assumption the JVM will sensibly allocate memory but I'm wondering if it's not doing that under Docker operating conditions? I can't see an obvious way of passing in a Java option to explicitly set the heap size. Anyone else hit an issue like this? (I don't think I'm running anything too heavy in Metabase)

      2020-11-02T16:02:01.000Z 2020-11-02 16:01:56,367 WARN strategy.EatWhatYouKill ::
      2020-11-02T16:02:01.000Z java.lang.OutOfMemoryError: Java heap space
      2020-11-02T16:02:01.000Z Exception in thread "MetabaseScheduler_QuartzSchedulerThread" java.lang.OutOfMemoryError: Java heap space
      2020-11-02T16:02:01.000Z 2020-11-02 16:02:01,028 WARN io.ManagedSelector :: java.lang.OutOfMemoryError: Java heap space
      2020-11-02T16:02:01.000Z 2020-11-02 16:02:01,089 ERROR sync.util :: Error fingerprinting Table 8 'hars'
      2020-11-02T16:02:01.000Z org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend.
      2020-11-02T16:02:01.000Z at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:337) ~[metabase.jar:?]
      2020-11-02T16:02:01.000Z at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:446) ~[metabase.jar:?]
      2020-11-02T16:02:01.000Z at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:370) ~[metabase.jar:?]
      2020-11-02T16:02:01.000Z at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:149) ~[metabase.jar:?]

      jamesgallagherJ 1 Reply Last reply
      0
      • girishG Offline
        girishG Offline
        girish
        Staff
        wrote on last edited by
        #2

        This looks like we have to set the java VM heap size (like -Xms1024m -Xmx1024m). Let me check why it's not getting set to something sensible by default.

        1 Reply Last reply
        1
        • girishG Offline
          girishG Offline
          girish
          Staff
          wrote on last edited by
          #3

          @jamesgallagher I have fixed the package to set the heap size. It was also recommended in the upstream docs - https://www.metabase.com/docs/latest/troubleshooting-guide/running.html

          jimcavoliJ 1 Reply Last reply
          1
          • girishG girish

            @jamesgallagher I have fixed the package to set the heap size. It was also recommended in the upstream docs - https://www.metabase.com/docs/latest/troubleshooting-guide/running.html

            jimcavoliJ Offline
            jimcavoliJ Offline
            jimcavoli
            App Dev
            wrote on last edited by
            #4

            @girish Thanks for taking care of that! I had done some fixed version of that and meant it to be variable but I guess that didn't hit the initial packaging.

            1 Reply Last reply
            1
            • jamesgallagherJ jamesgallagher

              I'm getting errors about the Java heap space fairly regularly (see sample below). They appear to take the Metabase app down. I had previously pushed the memory up on <my cloudron>/#/app/d00ef8b7-e3a6-43e3-8c3c-73d822c1fded/resources to 3GB but the container doesn't appear to hit that. A quick scan of Metabase docs seems to indicate there's an assumption the JVM will sensibly allocate memory but I'm wondering if it's not doing that under Docker operating conditions? I can't see an obvious way of passing in a Java option to explicitly set the heap size. Anyone else hit an issue like this? (I don't think I'm running anything too heavy in Metabase)

              2020-11-02T16:02:01.000Z 2020-11-02 16:01:56,367 WARN strategy.EatWhatYouKill ::
              2020-11-02T16:02:01.000Z java.lang.OutOfMemoryError: Java heap space
              2020-11-02T16:02:01.000Z Exception in thread "MetabaseScheduler_QuartzSchedulerThread" java.lang.OutOfMemoryError: Java heap space
              2020-11-02T16:02:01.000Z 2020-11-02 16:02:01,028 WARN io.ManagedSelector :: java.lang.OutOfMemoryError: Java heap space
              2020-11-02T16:02:01.000Z 2020-11-02 16:02:01,089 ERROR sync.util :: Error fingerprinting Table 8 'hars'
              2020-11-02T16:02:01.000Z org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend.
              2020-11-02T16:02:01.000Z at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:337) ~[metabase.jar:?]
              2020-11-02T16:02:01.000Z at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:446) ~[metabase.jar:?]
              2020-11-02T16:02:01.000Z at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:370) ~[metabase.jar:?]
              2020-11-02T16:02:01.000Z at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:149) ~[metabase.jar:?]

              jamesgallagherJ Offline
              jamesgallagherJ Offline
              jamesgallagher
              wrote on last edited by
              #5

              Thanks for looking into this and apologies for not following up - need to check my notification settings. (also work has been really busy so no mental energy for looking at my outside interests!)

              1 Reply Last reply
              1
              • M Offline
                M Offline
                markvanber
                wrote on last edited by
                #6

                Usually, this error is thrown when the Java Virtual Machine cannot allocate an object because it is out of memory, and no more memory could be made available by the garbage collector.

                Therefore you pretty much have two options:

                • Increase the default memory your program is allowed to use using the -Xmx option (for instance for 1024 MB: -Xmx1024m)

                • Modify your program so that it needs less memory, using less big data structures and getting rid of objects that are not any more used at some point in your program

                Increasing the heap sizeis a bad solution, 100% temporary. It will crash again in somewhere else. To avoid these issues, write high performance code:

                • Use local variables wherever possible.
                • Make sure you select the correct object (EX: Selection between String, StringBuffer and StringBuilder)
                • Use a good code system for your program(EX: Using static variables VS non static variables)
                • Other stuff which could work on your code.
                • Try to move with Multy Threading
                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Bookmarks
                  • Search