php-amqplib / php-amqplib

The most widely used PHP client for RabbitMQ
http://www.rabbitmq.com/getstarted.html
GNU Lesser General Public License v2.1
4.47k stars 1.03k forks source link

pcntl SIGHUP Consumer restart not working in demo #489

Closed wtorsi closed 5 years ago

wtorsi commented 7 years ago

Hi, Maybe I do something wrong, but after sending signal for restarting consumer using demo code (amqp_consumer_signals.php), the script stops catching other signals but restarts correctly, only

I'm not familiar with backstage code. So, do you know why this happens?

ramunasd commented 5 years ago

So problem here is that after SIGHUP new wait() loop is started inside signal handler function. It means new signal cannot be dispatched while previous handler function is not finished. Comment from docs: http://php.net/manual/en/function.pcntl-signal-dispatch.php#114234