[rabbitmq-discuss] php pecl and max channel reached with php-fpm
BeaT Adrian
aditza8 at gmail.com
Fri May 23 20:47:35 BST 2014
Hello all,
I`m just learning rabbitMQ and I ran into a problem.
Using http://pecl.php.net/package/amqp version 1.4 (latest now) and
RabbitMQ 3.3.1.
We must use php5-fpm and persistent connections with amqp->pconnect().
After a while (I guess 65500 requests) a problem occurs halting all writes
"Could not create channel. Connection has no open channel slots remaining"
>From what I have read in the sources is because every tcp connection have
an autoincrement channel ID that reaches its max. This happens because
every request must use the channel, and is no way to use the same channel (
I could not find a way into the php-amqp channel classs to make it
persistent) and scripts cannot communicate ( to use the same instance of
the channel as php object).
To lower the php-fpm lifetime is not an option, and either decoupling the
application-rabbitmq communication trough another technology/library etc.
Is there any easy way to fix this ?
Theoretically it should be one channel per thread (php5-fpm worker in this
case) but how can be achieved using this library ?
The code I`m using now (similar)
$this->con = new AMQPConnection(array(
> 'host' => $this->con_params['host'],
> 'port' => $this->con_params['port'],
> 'vhost' => $this->con_params['vhost'],
> 'login' => $this->con_params['user'],
> 'password' => $this->con_params['pass'],
> 'read_timeout' => 1,//seconds
> 'write_timeout' => 1,//seconds
> 'connect_timeout' => 1,//seconds
> ));
> $this->con->pconnect();
> $channel = new AMQPChannel($this->con);
> $queue = new AMQPQueue($channel);
> $queue->setName($queueName);
> $queue->setFlags(AMQP_DURABLE);
> //$queue->declareQueue();//make sure it exists
> $exchange = new AMQPExchange($channel);
> $exchange->setName($exchangeName);
> $exchange->setFlags(AMQP_DURABLE);
> $exchange->setType(AMQP_EX_TYPE_DIRECT);
> //$exchange->declareExchange();
> $this->queues[$queueName]->bind($exchangeName);
Thanks !!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140523/83c5786b/attachment.html>
More information about the rabbitmq-discuss
mailing list