oracle / truffleruby

A high performance implementation of the Ruby programming language, built on GraalVM.
https://www.graalvm.org/ruby/
Other
3.02k stars 185 forks source link

OutOfMemoryError when running the Asciidoctor tests suite against TruffleRuby 19.0.0 #1696

Open ggrossetie opened 5 years ago

ggrossetie commented 5 years ago

I'm trying to run the Asciidoctor tests suite against TruffleRuby 19.0.0. Here's the pull request: https://github.com/asciidoctor/asciidoctor/pull/3305/files

On Travis, I get an java.lang.OutOfMemoryError: Could not allocate an aligned heap chunk: https://travis-ci.org/asciidoctor/asciidoctor/jobs/534193527 Since the build didn't complete after 50 minutes, the stack trace is probably truncated:

the job exceeded the maximum time limit for jobs, and has been terminated.

To reproduce this error:

$ git clone https://github.com/asciidoctor/asciidoctor.git
$ cd asciidoctor
$ rvm install truffleruby-19.0.0
$ rvm use truffleruby-19.0.0
$ bundle install
$ bundle exec rake test

Please note that on my local machine (16gb) I cannot reproduce this error but the test suites is running very slowly compared to JRuby or MRI (something like 10th slower).

I'm wondering if we should just use more memory or if there's a memory leak hiding somewhere... Could you please give me some hints on how to generate a heap dump, so I can dig further ? đŸ¤“

Thanks!

eregon commented 5 years ago

On Travis, I get an java.lang.OutOfMemoryError: Could not allocate an aligned heap chunk: https://travis-ci.org/asciidoctor/asciidoctor/jobs/534193527

I got this recently too while trying to run RubyGems tests on TruffleRuby in TravisCI. A workaround is to set the maximum heap size manually with e.g., --vm.Xmx3g. This can be done globally with:

export TRUFFLERUBYOPT="--vm.Xmx3g"

This error message (Could not allocate an aligned heap chunk) is produced by Native Image, maybe we can do something better there to avoid this situation when running in TravisCI.

ggrossetie commented 5 years ago

I can confirm that using TRUFFLERUBYOPT="--vm.Xmx3g" solved this issue. If you think that the memory consumption is "normal" then feel free to close this issue.

eregon commented 5 years ago

If you think that the memory consumption is "normal"

I'd say it's not normal that it runs with a smaller heap but not the default (bigger, 80% of physical memory) heap. I'll investigate further.