Skip to content

The JVM SIGSEGVs when using RubyEtc.getgrgid #4057

@nbarrientos

Description

@nbarrientos

Hi,

[root@foo jruby-1.7.25]# PATH=bin/:$PATH ./bin/irb
irb(main):001:0> JRUBY_VERSION
=> "1.7.25"
irb(main):002:0> require 'java'
=> false
irb(main):003:0> java_import java.lang.System
=> [Java::JavaLang::System]
irb(main):004:0> System.getProperties["java.runtime.version"]
=> "1.7.0_111-mockbuild_2016_07_27_10_50-b00"
irb(main):005:0> a = [2688,2765,2746,2764,1008,1077,2745,1338,1665,1135,1157,1158,1160,1395,1470,1018,1399,1307]
=> [2688, 2765, 2746, 2764, 1008, 1077, 2745, 1338, 1665, 1135, 1157, 1158, 1160, 1395, 1470, 1018, 1399, 1307]
irb(main):006:0> (0..2).each{|th| Thread.new { (0..100000).each{|rr| a.each{ |x| puts Etc.getgrgid(x.to_i).name}} }}
=> 0..2
... # Output removed to hide group names...
irb(main):007:0>
...
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f840213b3e5, pid=29540, tid=140204612916992
#
# JRE version: OpenJDK Runtime Environment (7.0_99) (build 1.7.0_99-mockbuild_2016_03_25_01_00-b00)
# Java VM: OpenJDK 64-Bit Server VM (24.95-b01 mixed mode linux-amd64 compressed oops)
# Derivative: IcedTea 2.6.5
# Distribution: CentOS Linux release 7.2.1511 (Core) , package rhel-2.6.5.0.el7_2-x86_64 u99-b00
# Problematic frame:
# C  [libc.so.6+0x1633e5]  __strlen_sse2_pminub+0x35
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /tmp/jvm-29540/hs_error.log
#
# If you would like to submit a bug report, please include
# instructions on how to reproduce the bug and visit:
#   http://icedtea.classpath.org/bugzilla
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Aborted

Is this supposed to happen? IOW, is RubyEtc.getgrgid (or the libs used underneath) meant to be thread-safe?

We stumbled upon this crash when running Puppetserver that ships jRuby 1.7.20.1 however as you can see above the bug can be reproduced using the latest 1.7.

Full crash report

Thanks in advance for looking into it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions