Project

General

Profile

Bug #5169

Crash on Mac OSX when loading pdflib extension while running from RAILS

Added by rjsatwork (Rainer Schaaf) over 7 years ago. Updated over 7 years ago.

Status:
Third Party's Issue
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]
Backport:
[ruby-core:38854]

Description

When running ruby code that uses the PDFlib extension (http://www.pdflib.com/binaries/PDFlib/803/PDFlib-8.0.3-MacOSX-10.6-Universal-ruby.dmg) under Rails 3.0 on Mac OSX 10.6 ruby crashes (see attached crashlog).

When running similar ruby code (using the PDFlib extension) without Rails it works fine. Also Ruby 1.8 has no problem and I have tested the same thing on Linux (32bit), there it works fine too.


Files

ruby_2011-08-04-155629_BigMac.crash (29.5 KB) ruby_2011-08-04-155629_BigMac.crash rjsatwork (Rainer Schaaf), 08/09/2011 01:59 AM

History

Updated by kosaki (Motohiro KOSAKI) over 7 years ago

  • Status changed from Open to Third Party's Issue

Please don't ask aboutThird Party's extensions. We don't know it really. I recommend to contact the extension developer.

Updated by rjsatwork (Rainer Schaaf) over 7 years ago

Please check this issue again.

Searching for problems in the third party plugin ended in the approach to use a very simple extension to reproduce the probelm.

I ended up in using something very near to the example in "Programming Ruby 1.9" in chapter 29.

The code is:

#include "ruby.h"

static int id_push;

static VALUE t_init(VALUE self)
{
VALUE arr;

    arr = rb_ary_new();
    rb_iv_set(self, "@arr", arr);
    return self;

}

static VALUE t_add(VALUE self, VALUE obj)
{
VALUE arr;

    arr = rb_iv_get(self, "@arr");
    rb_funcall(arr, id_push, 1, obj);
    return arr;

}

VALUE cTest;

void Init_PDFlib()
{
cTest = rb_define_class("PDFlib", rb_cObject);
rb_define_method(cTest, "initialize", t_init, 0);
rb_define_method(cTest, "add", t_add, 1);
id_push = rb_intern("push");
}

Building a wrapper from this and using it still crashes rails. The coredump looks like this:

MyBigMac (1)$ rails server
=> Booting WEBrick
=> Rails 3.1.1 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-11-25 15:08:28] INFO WEBrick 1.3.1
[2011-11-25 15:08:28] INFO ruby 1.9.2 (2011-07-09) [x86_64-darwin10.8.0]
[2011-11-25 15:08:28] INFO WEBrick::HTTPServer#start: pid=10348 port=3000
Trace/BPT trap: 5 (core dumped)

MyBigMac (1)$ gdb /Users/rjs/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
/cores/core.10348
GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Mon Aug 8 20:32:45 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared
libraries .... done

Reading symbols for shared libraries . done
Reading symbols for shared libraries
..............................................................................................................................
done
#0 0x00007fff8ee69df2 in select$DARWIN_EXTSN ()
(gdb) bt
#0 0x00007fff8ee69df2 in select$DARWIN_EXTSN ()
#1 0x0000000100186ca1 in do_select (n=7, read=0x102d6ff40, write=0x0,
except=0x0, timeout=0x7fff5fbfde00) at thread.c:2516
#2 0x00000001000669cc in select_internal inlined at
/Users/rjs/.rvm/src/ruby-1.9.2-p290/io.c:7241
#3 0x00000001000669cc in select_call (arg=) at io.c:7314
#4 0x000000010003ecdf in rb_ensure (b_proc=0x1000664b0 ,
data1=140734799798368, e_proc=0x10005ed50 , data2=140734799798368)
at eval.c:743
#5 0x000000010005f61e in rb_f_select (argc=, argv=,
obj=) at io.c:7360
#6 0x000000010017bae3 in vm_call_cfunc inlined at
/Users/rjs/.rvm/src/ruby-1.9.2-p290/vm_insnhelper.c:402
#7 0x000000010017bae3 in vm_call_method (th=0x100301af0, cfp=0x1004ffad8,
num=4, blockptr=0x1, flag=0, id=, me=0x10034fe30, recv=4303817080) at vm_insnhelper.c:524
#8 0x0000000100166e73 in vm_exec_core (th=0x100301af0, initial=) at insns.def:1006
#9 0x000000010016f933 in vm_exec (th=0x100301af0) at vm.c:1147
#10 0x000000010017cde0 in rb_yield (val=4317168960) at vm.c:558
...

So it looks like it is not specific to some "Third-Party-Extension".

I can see the problem on Mac (10.6/10.7), with ruby 1.9 running with Rails 3 (3.0/3.1). Ruby 1.9 without rails is fine, Ruby 1.8 (even with Rails 3.x is fine).

I would be happy about any hint how to proceed on this, so that it is possible to use a C-extension with Ruby-1.9 on Mac.

Also available in: Atom PDF