Open
Description
Versions:
- Laravel/Lumen version: 12.13.0
- RabbitMQ version: 3.9.21
- Package version: 14.2.0
I am getting strange errors and I dont know how to fix them. Even how to debug.
I have ran queue with supervisord:
[program:project-queue]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/project.ge/artisan queue:work --queue=queue1,queue2,queue3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=project
numprocs=16
redirect_stderr=true
stdout_logfile=/var/www/project.ge/storage/logs/workers/queue.log
stopwaitsecs=3600
And in Sentry I have the following errors:
PhpAmqpLib\Exception\AMQPRuntimeException
: Lost connection: Channel connection is closed.PhpAmqpLib\Exception\AMQPProtocolChannelException
: PRECONDITION_FAILED - delivery acknowledgement on channel 1 timed out. Timeout value used: 1800000 ms.PhpAmqpLib\Exception\AMQPTimeoutException
: The connection timed out after 3 sec while awaiting incoming data.
Queue Config:
'rabbitmq' => [
'driver' => 'rabbitmq',
'queue' => env('RABBITMQ_QUEUE', 'default'),
'hosts' => [
[
'host' => env('RABBITMQ_HOST', '127.0.0.1'),
'port' => env('RABBITMQ_PORT', 5672),
'user' => env('RABBITMQ_USER', 'guest'),
'password' => env('RABBITMQ_PASSWORD', 'guest'),
'vhost' => env('RABBITMQ_VHOST', '/'),
],
],
'options' => [
'queue' => [
'job' => RabbitMQJob::class,
],
],
'connection' => RabbitMQConnection::class,
/*
* Set to "horizon" if you wish to use Laravel Horizon.
*/
'worker' => RabbitMQQueue::class,
'after_commit' => true,
],
The content of the RabbitMQQueue
:
<?php
declare(strict_types=1);
namespace App\Libraries\Queue;
use PhpAmqpLib\Channel\AMQPChannel;
use Throwable;
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\RabbitMQQueue as BaseRabbitMQQueue;
use function logger;
class RabbitMQQueue extends BaseRabbitMQQueue
{
protected function publishBasic($msg, $exchange = '', $destination = '', $mandatory = false, $immediate = false, $ticket = null): void
{
try {
parent::publishBasic($msg, $exchange, $destination, $mandatory, $immediate, $ticket);
} catch (Throwable $throwable) {
logger()->channel('queue')->warning('publishBasic: Exception occurred: ' . $throwable->getMessage() . '. Try to reconnect..');
$this->reconnect();
parent::publishBasic($msg, $exchange, $destination, $mandatory, $immediate, $ticket);
}
}
protected function publishBatch($jobs, $data = '', $queue = null): void
{
try {
parent::publishBatch($jobs, $data, $queue);
} catch (Throwable $throwable) {
logger()->channel('queue')->warning('publishBatch: Exception occurred: ' . $throwable->getMessage() . '. Try to reconnect..');
$this->reconnect();
parent::publishBatch($jobs, $data, $queue);
}
}
protected function createChannel(): AMQPChannel
{
try {
return parent::createChannel();
} catch (Throwable $throwable) {
logger()->channel('queue')->warning('createChannel: Exception occurred: ' . $throwable->getMessage() . '. Try to reconnect..');
$this->reconnect();
return parent::createChannel();
}
}
}
My current understanding of RabbitMQ is insufficient to determine the appropriate direction for further investigation.
Metadata
Metadata
Assignees
Labels
No labels