Signals and Restarting Syscalls

Discussion in 'Ruby' started by Curt Sampson, Jan 7, 2007.

  1. Curt Sampson

    Curt Sampson Guest

    I'm using fcgi.rb ruby-fcgi (0.8.7, according to the tarfile name, 0.8.5
    according to the comment in the source) and lighttpd. Unfortunately, lighttpd
    can't seem to shut down the ruby FastCGI servers:

    25457 1 lighttpd CALL kill(0x2095, SIGTERM)
    25457 1 lighttpd RET kill 0
    8341 1 ruby18 RET accept RESTART
    8341 1 ruby18 PSIG SIGTERM caught handler=0xbbbabdfc mask=())
    8341 1 ruby18 CALL setcontext(0xbfbe7df4)
    8341 1 ruby18 RET setcontext JUSTRETURN
    8341 1 ruby18 CALL accept(0,0xbfbe8190,0xbfbe818c)
    25457 1 lighttpd CALL unlink(0x806e800)
    25457 1 lighttpd NAMI "/u/cjs/co/dcity/instance.31041/sock/fastcgi-root-0"

    It appears that the ruby interpreter, in ruby_signal() in signal.c, goes
    and sets the SA_RESTART flag in the structure it passes to sigaction().
    So, the accept syscall that it's sitting in won't be returned from until
    the socket gets a connection, which is never going to happen because the
    socket file is gone.

    Anybody have any thoughts on what I can do about this silliness, short of
    modifying the Ruby interpreter?

    And why does Ruby do this, anyway?

    cjs
    --
    Curt Sampson <> +81 90 7737 2974
    The power of accurate observation is commonly called cynicism
    by those who have not got it. --George Bernard Shaw
    Curt Sampson, Jan 7, 2007
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sonic
    Replies:
    0
    Views:
    345
    sonic
    May 23, 2006
  2. Jan van Mansum

    syscalls.h or equivalent in cygwin or Linux

    Jan van Mansum, Jun 5, 2004, in forum: C Programming
    Replies:
    4
    Views:
    3,684
    Jan van Mansum
    Jun 5, 2004
  3. zb
    Replies:
    7
    Views:
    798
  4. walterbyrd
    Replies:
    9
    Views:
    292
    Bruno Desthuilliers
    Nov 19, 2006
  5. Fredrik Tolf

    KeyboardInterrupt from syscalls

    Fredrik Tolf, Nov 22, 2006, in forum: Python
    Replies:
    0
    Views:
    224
    Fredrik Tolf
    Nov 22, 2006
Loading...

Share This Page