Segfault in Ruby/ODBC

  • Thread starter Nathaniel Talbott
  • Start date
N

Nathaniel Talbott

My program is causing a segfault under load, and while I'm going to dig in
to figuring out why, I thought I'd go ahead and see if anyone here could
give me a hand. It appears that the Ruby/ODBC extension is somehow behaving
badly, and not being a C guy, I'd appreciate any help you can give me.

The backtrace below was generated off of an optimized ruby without debugging
info... I may be able to do it again and get better information, but not
immediately. Also, the program itself is large and proprietary, and as with
most SEGFAULTs, I can't reproduce the problem except with the full program
under load.

The make output:

make[1]: Entering directory
`/home/ntalbott/cvs/external-packages/cl-ruby-odbc/cl-ruby-odbc-0.99'
gcc -fPIC -Wall -W -I. -I/usr/lib/ruby/1.8/i386-linux
-I/usr/lib/ruby/1.8/i386-linux -I. -DHAVE_SQL_H -DHAVE_SQLEXT_H
-DHAVE_ODBCINST_H -c odbc.c
odbc.c: In function `dsn_new':
odbc.c:449: warning: unused parameter `self'
odbc.c: In function `drv_new':
odbc.c:474: warning: unused parameter `self'
odbc.c: In function `succeeded':
odbc.c:878: warning: unused parameter `m'
odbc.c: In function `dbc_raise':
odbc.c:984: warning: unused parameter `self'
odbc.c: In function `env_new':
odbc.c:1025: warning: type of `self' defaults to `int'
odbc.c:1033: warning: comparison between signed and unsigned
odbc.c: In function `dbc_dsns':
odbc.c:1062: warning: unused parameter `self'
odbc.c: In function `dbc_drivers':
odbc.c:1115: warning: unused parameter `self'
odbc.c: In function `conf_dsn':
odbc.c:1191: warning: unused parameter `self'
odbc.c: In function `dbc_error':
odbc.c:1306: warning: unused parameter `self'
odbc.c: In function `dbc_warn':
odbc.c:1312: warning: unused parameter `self'
odbc.c: In function `dbc_nop':
odbc.c:2361: warning: unused parameter `self'
odbc.c: In function `date_dump':
odbc.c:2808: warning: unused parameter `depth'
odbc.c: In function `time_dump':
odbc.c:3014: warning: unused parameter `depth'
odbc.c: In function `timestamp_dump':
odbc.c:3255: warning: unused parameter `depth'
odbc.c: In function `stmt_hash_mode':
odbc.c:4153: warning: unused parameter `self'
odbc.c: In function `mod_2time':
odbc.c:4824: warning: unused parameter `self'
odbc.c: In function `mod_2date':
odbc.c:4930: warning: unused parameter `self'
odbc.c: In function `mod_trace':
odbc.c:4967: warning: unused parameter `self'
gcc -shared -L"/usr/lib" -o odbc.so odbc.o -lodbcinst -lodbc -ldl
-lcrypt -lm -lc


The backtrace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 28249)]
0x400dd1f5 in mallopt () from /lib/libc.so.6
(gdb) bt
#0 0x400dd1f5 in mallopt () from /lib/libc.so.6
#1 0x400dc383 in malloc () from /lib/libc.so.6
#2 0x0806a48c in ruby_xmalloc ()
#3 0x080a9013 in st_init_table_with_size ()
#4 0x080a904f in st_init_table ()
#5 0x0806c91a in rb_hash ()
#6 0x0806c93c in rb_hash_new ()
#7 0x4077dee5 in _init () from
/usr/lib/ruby/site_ruby/1.8/i386-linux/odbc.so
#8 0x4077eb7e in _init () from
/usr/lib/ruby/site_ruby/1.8/i386-linux/odbc.so
#9 0x4077eeb0 in _init () from
/usr/lib/ruby/site_ruby/1.8/i386-linux/odbc.so
#10 0x0805b99e in rb_with_disable_interrupt ()
#11 0x0805c3f6 in rb_with_disable_interrupt ()
#12 0x0805729f in rb_Array ()
#13 0x080564dc in rb_Array ()
#14 0x080568d5 in rb_Array ()
#15 0x0805bfa9 in rb_with_disable_interrupt ()
#16 0x0805c3f6 in rb_with_disable_interrupt ()
#17 0x0805729f in rb_Array ()
#18 0x0805bfa9 in rb_with_disable_interrupt ()
#19 0x0805c3f6 in rb_with_disable_interrupt ()
#20 0x0805c569 in rb_apply ()
#21 0x0805b99e in rb_with_disable_interrupt ()
#22 0x0805c3f6 in rb_with_disable_interrupt ()
#23 0x0805729f in rb_Array ()
#24 0x080606d7 in rb_f_lambda ()
#25 0x08056364 in rb_Array ()
#26 0x080568d5 in rb_Array ()
#27 0x0805bfa9 in rb_with_disable_interrupt ()
#28 0x0805c3f6 in rb_with_disable_interrupt ()
#29 0x0805729f in rb_Array ()
#30 0x080568d5 in rb_Array ()
#31 0x0805bfa9 in rb_with_disable_interrupt ()
#32 0x0805c3f6 in rb_with_disable_interrupt ()
#33 0x0805729f in rb_Array ()
#34 0x08055dbe in rb_Array ()
#35 0x080568d5 in rb_Array ()
#36 0x08056a80 in rb_Array ()
#37 0x0805bfa9 in rb_with_disable_interrupt ()
#38 0x0805c3f6 in rb_with_disable_interrupt ()
#39 0x0805729f in rb_Array ()
#40 0x080606d7 in rb_f_lambda ()
#41 0x08056364 in rb_Array ()
#42 0x0805bfa9 in rb_with_disable_interrupt ()
#43 0x0805c3f6 in rb_with_disable_interrupt ()
#44 0x0805749c in rb_Array ()
#45 0x080606d7 in rb_f_lambda ()
#46 0x08056364 in rb_Array ()
#47 0x0805bfa9 in rb_with_disable_interrupt ()
#48 0x0805c3f6 in rb_with_disable_interrupt ()
#49 0x0805749c in rb_Array ()
#50 0x080564dc in rb_Array ()
#51 0x0805bfa9 in rb_with_disable_interrupt ()
#52 0x0805c3f6 in rb_with_disable_interrupt ()
#53 0x0805729f in rb_Array ()
#54 0x080564dc in rb_Array ()
#55 0x08059f13 in rb_iterator_p ()
#56 0x08060158 in rb_f_lambda ()
#57 0x080602b5 in rb_f_lambda ()
#58 0x0805b99e in rb_with_disable_interrupt ()
#59 0x0805c3f6 in rb_with_disable_interrupt ()
#60 0x0805729f in rb_Array ()
#61 0x0805bfa9 in rb_with_disable_interrupt ()
#62 0x0805c3f6 in rb_with_disable_interrupt ()
#63 0x0805729f in rb_Array ()
#64 0x08056b64 in rb_Array ()
#65 0x08059f13 in rb_iterator_p ()
#66 0x0805a0f5 in rb_yield ()
#67 0x080c1797 in rb_each ()
#68 0x08059efa in rb_iterator_p ()
#69 0x0805a0f5 in rb_yield ()
#70 0x080b81ee in rb_ary_each ()
#71 0x0805b9d1 in rb_with_disable_interrupt ()
#72 0x0805c3f6 in rb_with_disable_interrupt ()
#73 0x0805c629 in rb_funcall ()
#74 0x080c16a8 in rb_each ()
#75 0x0805a714 in rb_iterate ()
#76 0x080c1801 in rb_each ()
#77 0x0805b99e in rb_with_disable_interrupt ()
#78 0x0805c3f6 in rb_with_disable_interrupt ()
#79 0x0805729f in rb_Array ()
#80 0x080564dc in rb_Array ()
#81 0x08057d9a in rb_Array ()
#82 0x0805bfa9 in rb_with_disable_interrupt ()
#83 0x0805c3f6 in rb_with_disable_interrupt ()
#84 0x0805729f in rb_Array ()
#85 0x08057d9a in rb_Array ()
#86 0x0805bfa9 in rb_with_disable_interrupt ()
#87 0x0805c3f6 in rb_with_disable_interrupt ()
#88 0x0805749c in rb_Array ()
#89 0x0805bfa9 in rb_with_disable_interrupt ()
#90 0x0805c3f6 in rb_with_disable_interrupt ()
#91 0x0805749c in rb_Array ()
#92 0x0805bfa9 in rb_with_disable_interrupt ()
#93 0x0805c3f6 in rb_with_disable_interrupt ()
#94 0x0805c569 in rb_apply ()
#95 0x0805b99e in rb_with_disable_interrupt ()
#96 0x0805c3f6 in rb_with_disable_interrupt ()
#97 0x0805749c in rb_Array ()
#98 0x0805bfa9 in rb_with_disable_interrupt ()
#99 0x0805c3f6 in rb_with_disable_interrupt ()
#100 0x0805729f in rb_Array ()
#101 0x0805bfa9 in rb_with_disable_interrupt ()
#102 0x0805c3f6 in rb_with_disable_interrupt ()
#103 0x0805749c in rb_Array ()
#104 0x080568d5 in rb_Array ()
#105 0x08056a80 in rb_Array ()
#106 0x08056187 in rb_Array ()
#107 0x0805bfa9 in rb_with_disable_interrupt ()
#108 0x0805c3f6 in rb_with_disable_interrupt ()
#109 0x0805749c in rb_Array ()
#110 0x080568d5 in rb_Array ()
#111 0x08056a80 in rb_Array ()
#112 0x08059f13 in rb_iterator_p ()
#113 0x08064b20 in rb_thread_create ()
#114 0x08064894 in rb_thread_stop_timer ()
#115 0x08064c0e in rb_thread_create ()
#116 0x0805b99e in rb_with_disable_interrupt ()
#117 0x0805c3f6 in rb_with_disable_interrupt ()
#118 0x0805729f in rb_Array ()
#119 0x080564dc in rb_Array ()
#120 0x0805bfa9 in rb_with_disable_interrupt ()
#121 0x0805c3f6 in rb_with_disable_interrupt ()
#122 0x0805749c in rb_Array ()
#123 0x080606d7 in rb_f_lambda ()
#124 0x08056364 in rb_Array ()
#125 0x08057df7 in rb_Array ()
#126 0x08059f13 in rb_iterator_p ()
#127 0x0805a0f5 in rb_yield ()
#128 0x080b81ee in rb_ary_each ()
#129 0x0805b9d1 in rb_with_disable_interrupt ()
#130 0x0805c3f6 in rb_with_disable_interrupt ()
#131 0x0805729f in rb_Array ()
#132 0x080564dc in rb_Array ()
#133 0x080568d5 in rb_Array ()
#134 0x08056187 in rb_Array ()
#135 0x08059f13 in rb_iterator_p ()
#136 0x08056842 in rb_Array ()
#137 0x0805bfa9 in rb_with_disable_interrupt ()
#138 0x0805c3f6 in rb_with_disable_interrupt ()
#139 0x0805729f in rb_Array ()
#140 0x080564dc in rb_Array ()
#141 0x0805bfa9 in rb_with_disable_interrupt ()
#142 0x0805c3f6 in rb_with_disable_interrupt ()
#143 0x0805729f in rb_Array ()
#144 0x0805bfa9 in rb_with_disable_interrupt ()
#145 0x0805c3f6 in rb_with_disable_interrupt ()
#146 0x0805729f in rb_Array ()
#147 0x0805bfa9 in rb_with_disable_interrupt ()
#148 0x0805c3f6 in rb_with_disable_interrupt ()
#149 0x0805750c in rb_Array ()
#150 0x0805bfa9 in rb_with_disable_interrupt ()
#151 0x0805c3f6 in rb_with_disable_interrupt ()
#152 0x0805c569 in rb_apply ()
#153 0x0805b99e in rb_with_disable_interrupt ()
#154 0x0805c3f6 in rb_with_disable_interrupt ()
#155 0x0805749c in rb_Array ()
#156 0x0805bfa9 in rb_with_disable_interrupt ()
#157 0x0805c3f6 in rb_with_disable_interrupt ()
#158 0x0805729f in rb_Array ()
#159 0x08053460 in ruby_init ()
#160 0x0805392e in ruby_exec ()
#161 0x0805398a in ruby_run ()
#162 0x08051e62 in main ()
#163 0x40080db6 in __libc_start_main () from /lib/libc.so.6
(gdb)
(gdb) c
Continuing.
/usr/lib/ruby/site_ruby/1.8/DBD/ODBC/ODBC.rb:124: [BUG] Segmentation fault
ruby 1.8.1 (2003-10-31) [i386-linux]


Program received signal SIGABRT, Aborted.
0x400945f1 in kill () from /lib/libc.so.6


If more info would help, let me know and I'll try to provide it.

Thanks for any help you can give!


Nathaniel

<:((><
 
H

Hidetoshi NAGAI

Hi,

From: "Nathaniel Talbott" <[email protected]>
Subject: Segfault in Ruby/ODBC
Date: Sat, 8 Nov 2003 07:08:25 +0900
Message-ID: said:
My program is causing a segfault under load, and while I'm going to dig in
to figuring out why, I thought I'd go ahead and see if anyone here could
give me a hand. It appears that the Ruby/ODBC extension is somehow behaving
badly, and not being a C guy, I'd appreciate any help you can give me.

I don't know Ruby/ODBC, but I think that your trouble is similar
to the trouble on Ruby/Tk with pthread-enabled Tck/Tk libraries.
I worked to fix the Ruby/Tk problem last week, and added
'--with-pthead-ext' to configure options. If your trouble depends
on the same part of Ruby core, the option may help you.
 
H

Hidetoshi NAGAI

Hi,

From: "Nathaniel Talbott" <[email protected]>
Subject: Re: Segfault in Ruby/ODBC
Date: Mon, 10 Nov 2003 22:48:34 +0900
Message-ID: said:
Thanks for the reply! A few questions:
- How do I use the --with-pthread-ext configure option?
Do I pass it to extconf.rb for the extension? Or do I
need to enable it when I compile Ruby?

When enable '--with-pthread-ext', for example, 'pthread_mutex_lock'
is added to rb_thread_schedule() function on eval.c. That is, you
must re-configure and re-compile Ruby.

# Please pay attention to the patch for tcltklib.c.
# To fix the problem, I had to edit the source file as only one
# ruby-thread can call Tcl/Tk's internal functions.
- Is this option available under 1.8.1-preview2? Or do
I need to use the most recent CVS?

Please try the most recent CVS.
The last change for '--with-pthread-ext' option was adopted at
2003/11/08 13:49:50 JST.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top