-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Warning: stream_select(): unable to select [4]: Interrupted system call (max_fd=7) in /Users/stu/Dropbox/im_british_so_i_know_how_to_queue/src/chapter5/vendor/videlalvaro/php-amqplib/PhpAmqpLib/Wire/IO/StreamIO.php on line 103
If you add a signal handler, when a signal is caught this warning is output.
I've changed the basic wait loop to look like this:
while (count($channel->callbacks) && $this->continue) {
try {
$channel->wait(null, false, 1);
} catch (\PhpAmqpLib\Exception\AMQPTimeoutException $e) {
// Do nothing.
} catch (\PhpAmqpLib\Exception\AMQPRuntimeException $e) {
// Do nothing.
}
}
The timeout exception is expected, without the timeout the signalhandler never gets called, I guess because the stream stuff lower down is non tickable.
The AMQPRuntimeException is thrown by AMQPReader::wait because the call to select returns false, I just catch both exceptions & do nothing with them
I wonder if there's a better way to handle this? Before throwing either of the exceptions, check the result of socket_last_error and if the result isn't 0 or 10, throw the error? That way you can add @ to mask the warning & still get errors when required.
10 is the error code returned by socket_last_error when it is interrupted.
If this sounds like a good idea, I can send you a pull request with the changes.