# Signals and Restarting Syscalls

**URL:** <https://www.ruby-forum.com/t/signals-and-restarting-syscalls/81313>\
**Category:** Ruby\
**Created:** [January 7, 2007, 4:03pm UTC](https://www.ruby-forum.com/t/signals-and-restarting-syscalls/81313 "2007-01-07T16:03:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![curt\_s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b77776/32.png) [@curt\_s](https://www.ruby-forum.com/u/curt_s)\
**Post date:** [January 7, 2007, 4:03pm UTC](https://www.ruby-forum.com/t/signals-and-restarting-syscalls/81313/1 "2007-01-07T16:03:38Z")

</div>

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
