Sending SIGTERM causes exception
Hello,
I'm using php consumers with php-amqplib/RabbitMqBundle. Since php-amqplib/php-amqplib is upgraded to 2.8.0, I encounter an error when sending a SIGTERM signal to the consumer process (see https://github.com/php-amqplib/php-amqplib/issues/611).
I expect that SIGTERM is the good signal to make onprocess messages being properly terminated. But the exception makes the process to hardly fail...
Running the consumer with option without-signal prevent from SIGTERM to throw exception but I lose the proper termination of onprocess messages...
Is that a bug or a bad use of consumers ?
Here is the stacktrace
ErrorException: stream_select(): unable to select [4]: Interrupted system call (max_fd=9) (Most recent call first)
File /home/sites/test.com/releases/34/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Wire/IO/StreamIO.php line 461 in cleanup_error_handler
File /home/sites/test.com/releases/34/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Wire/IO/StreamIO.php line 462 in select
File /home/sites/test.com/releases/34/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Wire/IO/StreamIO.php line 244 in read
File /home/sites/test.com/releases/34/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Wire/AMQPReader.php line 151 in rawread
File /home/sites/test.com/releases/34/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Wire/AMQPReader.php line 106 in read
File /home/sites/test.com/releases/34/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Connection/AbstractConnection.php line 530 in wait_frame
File /home/sites/test.com/releases/34/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Connection/AbstractConnection.php line 578 in wait_channel
File /home/sites/test.com/releases/34/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Channel/AbstractChannel.php line 227 in next_frame
File /home/sites/test.com/releases/34/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Channel/AbstractChannel.php line 338 in wait
File /home/sites/test.com/releases/34/vendor/php-amqplib/rabbitmq-bundle/RabbitMq/Consumer.php line 88 in consume
File /home/sites/test.com/releases/34/vendor/php-amqplib/rabbitmq-bundle/Command/BaseConsumerCommand.php line 90 in execute
File /home/sites/test.com/releases/34/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php line 240 in run
File /home/sites/test.com/releases/34/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php line 876 in doRunCommand
File /home/sites/test.com/releases/34/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php line 215 in doRun
File /home/sites/test.com/releases/34/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php line 72 in doRun
File /home/sites/test.com/releases/34/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php line 122 in run
File /home/sites/test.com/releases/34/bin/console line 29 in <main>
I confirm I have a similar error, I think I’ll temporarily decide it by installing php-amqplib/php-amplib 2.7.3
I am having same issue on 2.8.1 (migrated a few weeks ago from 2.7.2).
Take a look here: https://github.com/php-amqplib/php-amqplib/commit/ef318f10927f5b5c1530ada9018a714571014352#diff-593ddf6cbc93f7e4518ba0d20c13a8d7R333
The message @alterphp mentions ("Interrupted system call") were skipped in the past as a normal behavior. And there was even a comment for that:
stream_select warning that it has been interrupted by a signal
And as you can see the message shown by @alterphp doesn't have errno=.
My error message doesn't have errno mentions too:
/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Wire/IO/StreamIO.php:473: stream_select(): unable to select [4]: Interrupted system call (max_fd=7)
Sorry, I haven't seen that this is RabbitMqBundle issues. The issue is definitely in the php-amqplib, not in this bundle.
Thanks @spectrox for your feedback ! I close issue here.