<div dir="ltr"><div>Hello all,</div><div><br></div><div>I`m just learning rabbitMQ and I ran into a problem.</div><div> </div><div>Using http://pecl.php.net/package/amqp version 1.4 (latest now) and RabbitMQ 3.3.1.</div><div>We must use php5-fpm and persistent connections with amqp->pconnect(). </div><div><br></div><div>After a while (I guess 65500 requests) a problem occurs halting all writes </div><div>"Could not create channel. Connection has no open channel slots remaining"</div><div><br></div><div>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).</div><div><br></div><div>To lower the php-fpm lifetime is not an option, and either decoupling the application-rabbitmq communication trough another technology/library etc.</div><div><br></div><div>Is there any easy way to fix this ? </div><div><br></div><div>Theoretically it should be one channel per thread (php5-fpm worker in this case) but how can be achieved using this library ? </div><div><br></div><div>The code I`m using now (similar)</div><div><br></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">$this->con = new AMQPConnection(array(<br><span class="Apple-tab-span" style="white-space:pre">     </span>'host'  <span class="Apple-tab-span" style="white-space:pre">               </span>=> $this->con_params['host'],<br><span class="Apple-tab-span" style="white-space:pre">       </span>'port'  <span class="Apple-tab-span" style="white-space:pre">               </span>=> $this->con_params['port'],<br><span class="Apple-tab-span" style="white-space:pre">       </span>'vhost' <span class="Apple-tab-span" style="white-space:pre">            </span>=> $this->con_params['vhost'],<br><span class="Apple-tab-span" style="white-space:pre">      </span>'login' <span class="Apple-tab-span" style="white-space:pre">            </span>=> $this->con_params['user'],<br><span class="Apple-tab-span" style="white-space:pre">       </span>'password' <span class="Apple-tab-span" style="white-space:pre">         </span>=> $this->con_params['pass'],<br><span class="Apple-tab-span" style="white-space:pre">       </span>'read_timeout'  => 1,//seconds<br><span class="Apple-tab-span" style="white-space:pre">    </span>'write_timeout' => 1,//seconds<br>'connect_timeout' => 1,//seconds<br>));<br>$this->con->pconnect();<br>$channel = new AMQPChannel($this->con);<br>$queue = new AMQPQueue($channel);<br>$queue->setName($queueName);<br>$queue->setFlags(AMQP_DURABLE);<br>//$queue->declareQueue();//make sure it exists<br>$exchange = new AMQPExchange($channel);<br>$exchange->setName($exchangeName);<br>$exchange->setFlags(AMQP_DURABLE);<br>$exchange->setType(AMQP_EX_TYPE_DIRECT);<br>//$exchange->declareExchange();<br>$this->queues[$queueName]->bind($exchangeName);</blockquote><div><br></div><div><br></div><div>Thanks !!</div></div>