JVM segmentation fault in logstash 6.2.0 while building rake artifacts:rpm in Docker Container

Hi @all,
I was trying to build logstash 6.2.0 from source and I am getting segmentation fault.
My system information is as follows:

Linux el7uek.x86_64.
openjdk 1.8.0_151.
jruby version 9.1.15.0

When I am trying to build logstash rake artifact:rpm I am getting core dump.
Please help.
Thanks
Sandeep Sarkar

Please show the full log.

Hi @magnusbaeck,

Please find below error message.

BUILD SUCCESSFUL in 8s
3 actionable tasks: 3 executed
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00000000000057d6, pid=90, tid=0x00007fb1dd006700
#
# JRE version: OpenJDK Runtime Environment (8.0_161-b14) (build 1.8.0_161-b14)
# Java VM: OpenJDK 64-Bit Server VM (25.161-b14 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  0x00000000000057d6
#
# Core dump written. Default location: /usr/share/logstash-6.2.0/core or core.90
#
# An error report file with more information is saved as:
# /usr/share/logstash-6.2.0/hs_err_pid90.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp

Thanks for helping out.
Sandeep Sarkar

Hi @magnusbaeck,
Pasting the stack trace here

#0  0x00007fe63a5da1f7 in raise () from /lib64/libc.so.6
#1  0x00007fe63a5db8e8 in abort () from /lib64/libc.so.6
#2  0x00007fe639e88259 in os::abort(bool) ()
   from /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/lib/amd64/server/libjvm.so
#3  0x00007fe63a08d986 in VMError::report_and_die() ()
   from /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/lib/amd64/server/libjvm.so
#4  0x00007fe63a08e057 in crash_handler(int, siginfo_t*, void*) ()
   from /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/lib/amd64/server/libjvm.so
#5  <signal handler called>
#6  0x00007fe639e823f6 in os::print_hex_dump(outputStream*, unsigned char*, unsigned char*, int) ()
   from /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/lib/amd64/server/libjvm.so
#7  0x00007fe63a08cad0 in VMError::report(outputStream*) ()
   from /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/lib/amd64/server/libjvm.so
#8  0x00007fe63a08d4bd in VMError::report_and_die() ()
   from /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/lib/amd64/server/libjvm.so
#9  0x00007fe639e91ec7 in JVM_handle_linux_signal ()
   from /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/lib/amd64/server/libjvm.so
#10 0x00007fe639e85678 in signalHandler(int, siginfo_t*, void*) ()
   from /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/lib/amd64/server/libjvm.so
#11 <signal handler called>
#12 0x00000000000057d6 in ?? ()
#13 0x00007fe5fa69925a in call3 ()
   from /usr/share/logstash-6.2.0/vendor/jruby/lib/jni/x86_64-Linux/libjffi-1.2.so
#14 0x00007fe5fa69b409 in invoke3 ()
   from /usr/share/logstash-6.2.0/vendor/jruby/lib/jni/x86_64-Linux/libjffi-1.2.so
#15 0x00007fe5fa69b606 in Java_com_kenai_jffi_Foreign_invokeN3O1 ()
   from /usr/share/logstash-6.2.0/vendor/jruby/lib/jni/x86_64-Linux/libjffi-1.2.so
#16 0x00007fe6250174d4 in ?? ()
#17 0x0000000000000000 in ?? ()

I used gdb $JAVA_HOME/bin/java core.180 to get stack trace.

Although I download jruby-bin-9.1.15.0.tar.gz and save it at vendor/_/ but it still downloads jruby-bin-9.1.13.0 as it is shown here from gradle. I think gradle-4.3 is configured to do this.

Downloading https://services.gradle.org/distributions/gradle-4.3-all.zip
.......................................................................................................................................................................................Unzipping /root/.gradle/wrapper/dists/gradle-4.3-all/2c1rgv6vofd95kl0ugolfeu5r/gradle-4.3-all.zip to /root/.gradle/wrapper/dists/gradle-4.3-all/2c1rgv6vofd95kl0ugolfeu5r
Set executable permissions for: /root/.gradle/wrapper/dists/gradle-4.3-all/2c1rgv6vofd95kl0ugolfeu5r/gradle-4.3/bin/gradle
Generating JAR file 'gradle-api-4.3.jar'
Download https://repo1.maven.org/maven2/org/jruby/jruby-complete/9.1.13.0/jruby-complete-9.1.13.0.pom
Download https://repo1.maven.org/maven2/org/jruby/jruby-artifacts/9.1.13.0/jruby-artifacts-9.1.13.0.pom
Download https://repo1.maven.org/maven2/org/jruby/jruby-parent/9.1.13.0/jruby-parent-9.1.13.0.pom
Download https://repo1.maven.org/maven2/org/sonatype/oss/oss-parent/7/oss-parent-7.pom
Download https://repo1.maven.org/maven2/org/jruby/jruby-complete/9.1.13.0/jruby-complete-9.1.13.0.jar
Download https://repo1.maven.org/maven2/org/yaml/snakeyaml/1.17/snakeyaml-1.17.pom
Download https://repo1.maven.org/maven2/de/undercouch/gradle-download-task/3.2.0/gradle-download-task-3.2.0.pom
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.pom
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/httpcomponents-client/4.5.2/httpcomponents-client-4.5.2.pom
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/project/7/project-7.pom
Download https://repo1.maven.org/maven2/org/apache/apache/13/apache-13.pom
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/httpcore/4.4.4/httpcore-4.4.4.pom
Download https://repo1.maven.org/maven2/commons-logging/commons-logging/1.2/commons-logging-1.2.pom
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/httpcomponents-core/4.4.4/httpcomponents-core-4.4.4.pom
Download https://repo1.maven.org/maven2/org/apache/commons/commons-parent/34/commons-parent-34.pom
Download https://repo1.maven.org/maven2/commons-codec/commons-codec/1.9/commons-codec-1.9.pom
Download https://repo1.maven.org/maven2/org/apache/commons/commons-parent/32/commons-parent-32.pom
Download https://repo1.maven.org/maven2/org/yaml/snakeyaml/1.17/snakeyaml-1.17.jar
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.jar
Download https://repo1.maven.org/maven2/de/undercouch/gradle-download-task/3.2.0/gradle-download-task-3.2.0.jar
Download https://repo1.maven.org/maven2/commons-codec/commons-codec/1.9/commons-codec-1.9.jar
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/httpcore/4.4.4/httpcore-4.4.4.jar
Download https://repo1.maven.org/maven2/commons-logging/commons-logging/1.2/commons-logging-1.2.jar
Download https://jcenter.bintray.com/com/github/jengelman/gradle/plugins/shadow/1.2.4/shadow-1.2.4.pom
Download https://repo1.maven.org/maven2/org/jdom/jdom2/2.0.5/jdom2-2.0.5.pom
Download https://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/2.0.6/plexus-utils-2.0.6.pom
Download https://repo1.maven.org/maven2/org/codehaus/plexus/plexus/2.0.7/plexus-2.0.7.pom
Download https://repo1.maven.org/maven2/org/ow2/asm/asm-commons/5.0.3/asm-commons-5.0.3.pom
Download https://repo1.maven.org/maven2/org/ow2/asm/asm/5.0.3/asm-5.0.3.pom
Download https://repo1.maven.org/maven2/commons-io/commons-io/2.4/commons-io-2.4.pom
Download https://repo1.maven.org/maven2/org/codehaus/groovy/groovy-backports-compat23/2.4.4/groovy-backports-compat23-2.4.4.pom
Download https://repo1.maven.org/maven2/org/ow2/asm/asm-parent/5.0.3/asm-parent-5.0.3.pom
Download https://repo1.maven.org/maven2/org/apache/commons/commons-parent/25/commons-parent-25.pom
Download https://repo1.maven.org/maven2/org/apache/ant/ant/1.9.4/ant-1.9.4.pom
Download https://repo1.maven.org/maven2/org/ow2/ow2/1.3/ow2-1.3.pom
Download https://repo1.maven.org/maven2/org/apache/ant/ant-parent/1.9.4/ant-parent-1.9.4.pom
Download https://repo1.maven.org/maven2/org/apache/apache/9/apache-9.pom
Download https://repo1.maven.org/maven2/org/ow2/asm/asm-tree/5.0.3/asm-tree-5.0.3.pom
Download https://repo1.maven.org/maven2/org/apache/ant/ant-launcher/1.9.4/ant-launcher-1.9.4.pom
Download https://repo1.maven.org/maven2/org/ow2/asm/asm-tree/5.0.3/asm-tree-5.0.3.jar
Download https://repo1.maven.org/maven2/org/ow2/asm/asm-commons/5.0.3/asm-commons-5.0.3.jar
Download https://repo1.maven.org/maven2/org/jdom/jdom2/2.0.5/jdom2-2.0.5.jar
Download https://repo1.maven.org/maven2/commons-io/commons-io/2.4/commons-io-2.4.jar
Download https://repo1.maven.org/maven2/org/apache/ant/ant/1.9.4/ant-1.9.4.jar
Download https://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/2.0.6/plexus-utils-2.0.6.jar
Download https://repo1.maven.org/maven2/org/codehaus/groovy/groovy-backports-compat23/2.4.4/groovy-backports-compat23-2.4.4.jar
Download https://repo1.maven.org/maven2/org/apache/ant/ant-launcher/1.9.4/ant-launcher-1.9.4.jar
Download https://jcenter.bintray.com/com/github/jengelman/gradle/plugins/shadow/1.2.4/shadow-1.2.4.jar
Download https://repo1.maven.org/maven2/org/ow2/asm/asm/5.0.3/asm-5.0.3.jar
Download http://jruby.org.s3.amazonaws.com/downloads/9.1.13.0/jruby-bin-9.1.13.0.tar.gz

Please tell me what to do?

Hi @magnusbaeck,

Found that segmentation fault occurs when I build logstash 6.2 within docker container. logstash 6.1.3 builds successfully though using same rake artifact:rpm command.
But I need to build logstash 6.2 within docker container and create image out of it.

Any idea would be helpful.
Within docker container when I provide JRUBY_OPTS='-J-Xmn2g -J-Xms4g -J-Xmx4g' I get Initial heap size set to a larger value than the maximum heap size .

Please suggest what to do.
Thanks
Sandeep Sarkar

Hi!

Exact same behavior with an LXC-based container with JDK 9.0.4 and Jruby 9.1.13. Also tested with Same Jruby and JDK 1.8u91

This is the command used to build logstash :

export PWD=/home/builder/logstash/ && export USER=root && export HOME=/home/builder/logstash/ && export GRADLE_USER_HOME=/home/builder/logstash/ && export PATH=/usr/local/ruby/jruby-9.1.13/bin/:/us
r/local/java/9.0.4_jdk/bin:$PATH && export JAVA_HOME=/usr/local/java/9.0.4_jdk/ && rake artifact:tar

Hi @Nathan_Delhaye,

It seems there is issue with jruby native code libjffi.so . gradle downloads jruby under vendor/ and uses that to execute rake artifact:rpm. Try downloading jruby by

gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && \
\curl -sSL https://get.rvm.io | bash -s stable --ruby=jruby-9.1.13.0

Then set path to your jruby installation.
Also you would need bundler which can be installed by jruby -S gem install bundler. Then you may invoke jruby -S rake artifact:rpm. But before this you may also need to export USE_RUBY=1 to use your local ruby installation.

@Sandeep_Sarkar It seem that our problems are not similar since with my setup I've sucessfully builded 6.2.0 using the exact same command... but with an interactive shell

I'm looking deeper into this issue

OK. Please share your findings once you succeed.

Fixed using export USE_RUBY=1 since the problem was integrated jruby build. Building jruby on the same machine and then using it with USE_RUBY fix the problem.

1 Like

Same here. Although I posted about that above.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.