Gearman Server and Client Libraries

NON_BLOCKING mode does not responds on sent signals

Reported by Ilya Sabelnikov on 2012-11-27
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Gearman
Undecided
Unassigned

Bug Description

Hello,

When my Gearman worker runs in GEARMAN_WORKER_NON_BLOCKING mode, it ignores signals sent to PHP script (except KILL signal).

I believe, it is not a PHP PECL extension bug, because I couldn't find any place, where it somehow ignores it in php_gearman.c.

My simple test is here: http://pastie.org/5440196

My steps to reproduce it apathetic behavior:

  $ php gearman_signal_ignore.php > out.log 2>&1 &
  [1] 71643
  $ ps aux | grep -v grep | grep gearman_signal_ignore
  fruit 71643 0.0 0.5 439920 19252 5 IJ 3:20AM 0:00.11 php gearman_signal_ignore.php
  $ kill -INT 71643
  $ ps aux | grep -v grep | grep gearman_signal_ignore
  fruit 71643 0.0 0.5 439920 19252 5 SJ 3:20AM 0:00.11 php gearman_signal_ignore.php
  $ kill -TERM 71643
  $ ps aux | grep -v grep | grep gearman_signal_ignore
  fruit 71643 0.0 0.5 439920 19252 5 SJ 3:20AM 0:00.11 php gearman_signal_ignore.php
  $ kill -KILL 71643
  [1]+ Killed: 9 php gearman_signal_ignore.php > out.log 2>&1
  $ ps aux | grep -v grep | grep gearman_signal_ignore
  $ cat out.log
  Working...
  Waiting for next job... (code: 1)
  Working...
  Waiting for next job... (code: 1)
  Working...
  Waiting for next job... (code: 35)
  $ #EOF

Also, in attachments you can find a gdb backtrace.

P.S. When I use GEARMAN_TIMEOUT instead of NON_BLOCKING, it handles signals correctly.

Ilya Sabelnikov (fruit-dev) wrote :

My environment was:
  libgearman: v1.1.3
  PHP: 5.3.10 (PECL extension v1.0.1)
  OS: FreeBSD 8.1 x64

Brian Aker (brianaker) wrote :

No signal handler is installed in the library, so I would assume that this is a PECL problem.

Changed in gearmand:
status: New → Invalid
Ilya Sabelnikov (fruit-dev) wrote :

Thanks for your time.

Corresponding bug report in PECL was opened here: https://bugs.php.net/bug.php?id=63647

schkovich (schkovich) wrote :

The problem is that the method GearmanWorker::wait() respects worker timeout. Default timeout is -1 e.g. never causing GearmanWorker::wait() to block execution. If you set timeout signals will be respected. You will had to handle GEARMAN_TIMEOUT return in your example to make it work.

If there is no timeout, could libgearman still return from its wait() if a SIGINT or SIGTERM is received?

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.