Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#6 broken signal handling

open
None
5
2004-12-22
2004-12-16
No

Several times over the period of just trying things out
with TclMagick I've managed to cause segfaults when
typing ^C in NetBSD 2.0 i386.

It seems that the signal handler stack overflows, or
something like that. The following patterns repeat
over 10,000 times.

This has happened with Tcl 8.4.9 and the Tcl HEAD as of
Dec 16, 2004.

(gdb) where
#0 0x484bfbe3 in SetMagickSignalHandler () from
/usr/pkg/lib/libMagick.so.6
#1 0x484bfccf in MagickSignalHandler () from
/usr/pkg/lib/libMagick.so.6
#2 <signal handler called>
#3 0x482d0feb in kill () from /usr/lib/libc.so.12
#4 0x482ef1a8 in raise () from /usr/lib/libc.so.12
#5 0x484bfcd7 in MagickSignalHandler () from
/usr/pkg/lib/libMagick.so.6
#6 <signal handler called>
#7 0x482d0feb in kill () from /usr/lib/libc.so.12
#8 0x482ef1a8 in raise () from /usr/lib/libc.so.12
#9 0x484bfcd7 in MagickSignalHandler () from
/usr/pkg/lib/libMagick.so.6
#10 <signal handler called>
#11 0x482d0feb in kill () from /usr/lib/libc.so.12
#12 0x482ef1a8 in raise () from /usr/lib/libc.so.12
#13 0x484bfcd7 in MagickSignalHandler () from
/usr/pkg/lib/libMagick.so.6
#14 <signal handler called>
#15 0x482d0feb in kill () from /usr/lib/libc.so.12
#16 0x482ef1a8 in raise () from /usr/lib/libc.so.12
#17 0x484bfcd7 in MagickSignalHandler () from
/usr/pkg/lib/libMagick.so.6
#18 <signal handler called>
#19 0x482d0feb in kill () from /usr/lib/libc.so.12
#20 0x482ef1a8 in raise () from /usr/lib/libc.so.12
#21 0x484bfcd7 in MagickSignalHandler () from
/usr/pkg/lib/libMagick.so.6
#22 <signal handler called>

Discussion

  • Logged In: YES
    user_id=128624

    Does the same thing happen when running ImageMagick
    utilities like 'convert' and 'display'? If it happens
    outside of TclMagick then it is not TclMagick's fault.

     
  • Logged In: YES
    user_id=585068

    I tested with ImageMagick's display, and I am not able to
    duplicate the problem.

    I typed ^C while convert was busy enlarging an image, and I
    am not able to duplicate the problem.

    So, it does seem to be something in TclMagick that brings
    this bug out, or that occurs because something in
    ImageMagick wasn't initialized properly.

     
  • Logged In: YES
    user_id=585068

    I used a gdb script to get a more usable backtrace, and the
    relevant parts are below. I still don't know why this
    endless loop occurs, or why the segfault eventually occurs.
    It seems the next logical step is to study MagickSignalHandler.

    $ tail -n 20 /tmp/foo/lib/log
    #47586 <signal handler called>
    #47587 0x482aafeb in kill () from /usr/lib/libc.so.12
    #47588 0x482c91a8 in raise () from /usr/lib/libc.so.12
    #47589 0x48499cd7 in MagickSignalHandler () from
    /usr/pkg/lib/libMagick.so.6
    #47590 <signal handler called>
    #47591 0x482aafeb in kill () from /usr/lib/libc.so.12
    #47592 0x482c91a8 in raise () from /usr/lib/libc.so.12
    #47593 0x48499cd7 in MagickSignalHandler () from
    /usr/pkg/lib/libMagick.so.6
    #47594 <signal handler called>
    #47595 0x482aafeb in kill () from /usr/lib/libc.so.12
    #47596 0x482c91a8 in raise () from /usr/lib/libc.so.12
    #47597 0x48499cd7 in MagickSignalHandler () from
    /usr/pkg/lib/libMagick.so.6
    #47598 <signal handler called>
    #47599 0x482aaea7 in select () from /usr/lib/libc.so.12
    #47600 0x4819e2a8 in Tcl_WaitForEvent () from
    /home/gps/runtime/lib/libtcl84.so
    #47601 0x48181225 in Tcl_DoOneEvent () from
    /home/gps/runtime/lib/libtcl84.so
    #47602 0x480824bd in Tk_MainLoop () from
    /home/gps/runtime/lib/libtk84.so
    #47603 0x4808d6c3 in Tk_MainEx () from
    /home/gps/runtime/lib/libtk84.so
    #47604 0x080489f9 in main ()
    #47605 0x08048772 in ___start ()

     
    • assigned_to: nobody --> davidw
     
  • Logged In: YES
    user_id=240

    Thanks. Can you give me a parray tcl_platform so that we
    can see what system you have, threaded or not, etc? Also,
    how you compiled IM and TclMagick (the configure lines).

     
  • Logged In: YES
    user_id=585068

    $ wish8.4
    % parray tcl_platform
    tcl_platform(byteOrder) = littleEndian
    tcl_platform(machine) = i386
    tcl_platform(os) = NetBSD
    tcl_platform(osVersion) = 2.0_BETA
    tcl_platform(platform) = unix
    tcl_platform(user) = gps
    tcl_platform(wordSize) = 4

    I didn't configure ImageMagick. I used pkgsrc. I modified
    the ImageMagick configure with "echo $*" and found that it
    does this (with a default make):
    --without-dps --without-fpx --without-hdf --without-jbig
    --without-threads --without-lcms --without-perl
    --host=i386--netbsdelf --prefix=/usr/pkg
    --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib
    --without-libintl-prefix --without-libiconv-prefix
    --without-dps --without-fpx --without-hdf --without-jbig
    --without-threads --without-lcms --without-perl
    --host=i386--netbsdelf --prefix=/usr/pkg
    --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib
    --without-libintl-prefix --without-libiconv-prefix

    TclMagick was configured via:
    $ cat GPS_conf.sh
    ./configure --prefix=/tmp/foo \ --with-magick=/usr/pkg/bin/Wand-config \ --with-tcl=/home/gps/src/cvs/stable/Dec_7_tcl_bld \ --with-tk=/home/gps/src/cvs/stable/Dec_7_tk_bld

    Perhaps someone with Linux could try using the pkgsrc
    ImageMagick with TclMagick. Also; Kroc/David Zolli has run
    into many segfaults with TclMagick, but he doesn't have gdb
    installed, so he hasn't been able to get a backtrace. AFAIK
    David doesn't use pkgsrc for ImageMagick.

     
  • Logged In: YES
    user_id=128624

    The behavior is as if a signal occured within the signal
    handler, which caused the signal handler to be invoked
    again. This could happen if the signal handler was
    registered to handle signals like SIGBUS, SIGILL, or
    SIGSEGV which may occur when something goes wrong in the
    program. Maybe ImageMagick is registering for these signals,
    which most programs do not try to catch.