Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

thin restart fails because 'daemons' gem steals HUP signal

#152

I am running
thin (1.3.1)
daemons (1.1.5)
on OS X. The bug should be cross-platform

The problem is that daemonized thin server restart is borked. Restart times out, uses kill instead. See attached file for sample session.

Why does it happen:
Thin uses 'HUP' signal to restart. Signal is set in:
server.rb:setup_signals > trap('HUP') { restart }

When thin calls daemons gem to daemonize, the gem removes HUP handler
daemonize.rb:220 > trap 'SIGHUP', 'IGNORE'

What happens then?

You run thin restart, it sends HUP signal, removes the pid file, waits for restart. The daemonized server does not trap the signal, because trap has been remove. Caller times out waiting for new pid file, sends KILL which works.

My personal development workaround is to hack daemons gem. I hope this is fixed before I push to production.

Fix:
In thin, you could reset the trap after daemonize, but I did not see the clean code path to do this, so no patch.

Reported by Aleksandar Totic · February 9th, 2012 @ 01:51 AM

State: new
Milestone: none
Assigned to: macournoyer macournoyer

Activity

  1. macournoyer
    macournoyer

    I've moved the ticket to github: https://github.com/macournoyer/thin/issues/91.

    Will check that out. Thx!

    February 23rd, 2012 @ 09:49 AM

  2. John
    John

    Ludzie starają się, aby Kasyna online mogą być zarówno dobre jak i złe dla Twojego portfela. Jeśli nie chcesz tracić czasu na bezużyteczne ankiety, po prostu odwiedź kasyno mr bet kod promocyjny bez depozytu i odbierz swoje bonusy. Jedyne kasyno, które mogę polecić to TO, bo ludzie mu ufają, Tam znajdziesz największą liczbę różnorodnych gier, od gier stołowych po gry slotowe.

    January 8th, 2025 @ 09:07 AM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.