Bugs: Browse | Submit New | Admin

[#29463] Segmentation fault with ruby 1.8.7 and rjb 1.3.8.

Date:
2011-12-05 14:29
Priority:
3
Submitted By:
Hans de Graaff (graaff)
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
Segmentation fault with ruby 1.8.7 and rjb 1.3.8.

Detailed description
When trying to use rjb 1.3.8 in a Rails project I'm getting segmentation faults when trying to save an ActiveRecord
object after doing some work with Rjb.

In pseudocode I'm doing:

Rjb::load('file.jar')
klass = Rjb::import('a.class')
instance = klass.new
value = instance.method

User.create!(:value => value)

(I can't share the actual code since it is proprietary and not my property).

This leads to a crash that does not reference rjb itself:

Program received signal SIGSEGV, Segmentation fault.
rb_eval (self=140737135005000, n=0x7ffff45e0d98) at eval.c:2977
2977	eval.c: No such file or directory.
	in eval.c
(gdb) bt
#0  rb_eval (self=140737135005000, n=0x7ffff45e0d98) at eval.c:2977
#1  0x00007ffff7b18e8d in rb_eval (self=140737135005000, n=0x7ffff45e0cd0) at eval.c:3510
#2  0x00007ffff7b1909a in rb_eval (self=140737135005000, n=0x7ffff45e0c08) at eval.c:3526
#3  0x00007ffff7b1c11d in rb_eval (self=140737135005000, n=0x7ffff45dfdd0) at eval.c:3332
#4  0x00007ffff7b13790 in rb_call0 (klass=140737293187240, recv=140737135005000, 
    id=35873, oid=<value optimized out>, argc=<value optimized out>, 
    argv=<value optimized out>, body=0x7ffff45dfd80, flags=2) at eval.c:6089
#5  0x00007ffff7b13a97 in rb_call (klass=140737293187240, recv=140737135005000, 
    mid=35873, argc=1, argv=0x7ffffff04c90, scope=1, self=<value optimized out>)
    at eval.c:6186
#6  0x00007ffff7b19154 in rb_eval (self=140737135005000, n=0x7ffff45c75c8) at eval.c:3531
#7  0x00007ffff7b1209d in rb_yield_0 (val=140737045442640, self=140737135005000, 
    klass=<value optimized out>, flags=0, avalue=0) at eval.c:5105
#8  0x00007ffff7af6b48 in rb_ary_collect (ary=140737045444800) at array.c:1838


I'm not sure how to provide additional debugging info, but since it is easy for me to reproduce this I'm happy to try
out some things if you think it is useful.

Add A Comment: Notepad

Please login


Followup

Message
Date: 2012-03-03 07:31
Sender: arton Tajima

Great! so you've solved the issue as your hands.

At this time, I have no clue. So your decision to wrap the java
object by ruby's object is reasonble and sane, because the segv
was occurred in Ruby's evaluator.

Thanks, and I'll continue to search the cause.
Date: 2012-02-29 18:43
Sender: Hans de Graaff

In my case it returns a custom class from a proprietary jar
that I do not have sourcecode for. I ended up creating a
simple wrapper app instead that I'm calling via system. Less
elegant but also gets the job done.
Date: 2012-02-29 18:01
Sender: arton Tajima

Hi,

What is the value ? String, Numeric, or Rjb Proxy ? In other
words, what type object does a.class's instance returns ?
Date: 2012-02-29 12:22
Sender: Ricardo Vila

I'm facing a similar issue running our rails project within Mongrel
using rjb.

Our project uses:

ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]
rails (2.3.14)
rjb (1.3.5)
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) Server VM (build 20.2-b06, mixed mode

This all runs on a Ubuntu 11.11 Oneiric Ocelot. 

The problem apears when the app creates any pdf (using rjb for
call jasper reports). The next call to the server after that
makes that a log s written with Acrtive record an then the
Segmentation Fault happends.
I can't give any log, the server simply says 'Fallo de segmento'
wich is te spanish translation for segmentation fault.

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item