Php-amqplib: Exception while handling AMQPTimeoutException

Created on 30 Oct 2019  路  4Comments  路  Source: php-amqplib/php-amqplib

Version(s) affected: v2.10.1

Description
After upgrade from v2.8.1 we see a new error in our logs:

Error: Noticed exception 'Error' with message 'Call to a member function setTimeout() on null' in /var/www/data/cabinet/releases/20191030111215/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Connection/AbstractConnection.php:570
in PhpAmqpLib\Connection\AbstractConnection::wait_frame called at /var/www/data/cabinet/releases/20191030111215/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Connection/AbstractConnection.php (608)
in PhpAmqpLib\Connection\AbstractConnection::wait_channel called at /var/www/data/cabinet/releases/20191030111215/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Channel/AbstractChannel.php (231)
in PhpAmqpLib\Channel\AbstractChannel::next_frame called at /var/www/data/cabinet/releases/20191030111215/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Channel/AbstractChannel.php (349)
in PhpAmqpLib\Channel\AbstractChannel::wait called at /var/www/data/cabinet/releases/20191030111215/protected/modules/queue/QueueConsumer.php (158)

How to reproduce
Project has this (pretty generic) code:

try {
    while (count($channel->callbacks)) {
        $channel->wait(null, false, $this->gracefulMaxExecution);
    }
} catch (AMQPTimeoutException $e) {
    // Do nothing, it's OK to exit by timeout
    $this->log(\CLogger::LEVEL_PROFILE, 'Exit by timeout');
}

The CLI consumer is run by supervisord, and is restarted when project is deployed to production.

Possible Solution
Wrap $this->input with an if, the same way it's done for AMQPNoDataException: https://github.com/php-amqplib/php-amqplib/blob/v2.10.1/PhpAmqpLib/Connection/AbstractConnection.php#L570

bug

All 4 comments

Will there be a new release with this fix soon?

@lukebakken We are ready to release v2.11.0, let's not waste more time on it.

I saw that there were still two open issues in the milestone. They weren't closed when their associated PRs were merged.

Fixed by #753

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maprokopiou picture maprokopiou  路  4Comments

prolic picture prolic  路  6Comments

tugrul picture tugrul  路  3Comments

FrancisVarga picture FrancisVarga  路  5Comments

Majkl578 picture Majkl578  路  8Comments