Crash when handling exception coming from an signal handler


#1

Hi,

I got some strange crashes when handling an exception coming from a
signal
handler. I was able to make a contrived example that triggers it
reliably
(on some of my systems) :frowning:

valgrind shows the following:
==10757== Invalid read of size 8
==10757== at 0x5760FA0: g_signal_emit_valist (in
/usr/lib/libgobject-2.0.so.0.1000.2)
==10757== by 0x5761382: g_signal_emit (in
/usr/lib/libgobject-2.0.so.0.1000.2)
==10757== by 0x791E41B: gtk_adjustment_value_changed (in
/usr/lib/libgtk-x11-2.0.so.0.800.17)
==10757== by 0x7729936: (within
/usr/lib/ruby/1.8/x86_64-linux/gtk2.so)
==10757== by 0x4B530EB: (within /usr/lib/libruby1.8.so.1.8.4)
==10757== by 0x4B53540: (within /usr/lib/libruby1.8.so.1.8.4)
==10757== by 0x4B4F1F5: (within /usr/lib/libruby1.8.so.1.8.4)
==10757== by 0x4B51106: (within /usr/lib/libruby1.8.so.1.8.4)
==10757== by 0x4B5D5BA: (within /usr/lib/libruby1.8.so.1.8.4)
==10757== by 0x4B5D604: ruby_exec (in
/usr/lib/libruby1.8.so.1.8.4)
==10757== by 0x4B5F8A1: ruby_run (in
/usr/lib/libruby1.8.so.1.8.4)
==10757== by 0x4007B8: main (in /usr/bin/ruby1.8)
==10757== Address 0x7FEFFD438 is not stack’d, malloc’d or
(recently) free’d

I digged somewhat deeper and it appears that the g_restart_emissions
in
glib2’s gsignal.c points to some memory that’s no longer on the
stack :(… Probably because of some strange interaction between glib’s
signal
handling and ruby jumping to another (exception handling) context…

Sjoerd


#2

Hi,

Hmm, it doesn’t occur on my system.

% ruby test.rb
test.rb:10: undefined method `bloep!’ for main:Object (NoMethodError)
from test.rb:20
% ruby -v
ruby 1.8.4 (2005-12-24) [i686-linux]

Ruby-GNOME2 is latest CVS version,
with your rbgclosure patch.

Tell me the detail of your system what this problem occures.

If it’s on x86_64 system only,
I can’t test it … it may be a problem with incorrect casting anywhere.

On Fri, 12 May 2006 12:41:18 +0200
removed_email_address@domain.invalid (Sjoerd S.) wrote:

==10757==    by 0x5761382: g_signal_emit (in
==10757==    by 0x4B5F8A1: ruby_run (in /usr/lib/libruby1.8.so.1.8.4)

“It’s today!” said Piglet.
“My favorite day,” said Pooh.

.:% Masao M.removed_email_address@domain.invalid


Using Tomcat but need to do more? Need to support web services,
security?
Get stuff done quickly with pre-integrated technology to make your job
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642