Guys,
I found a potential bug, but I am surprised that no one here has mentioned about it before. It looks to be a often used feature, so I may be using it in the wrong way.
I am calling wait_for_pending_acks channel method right after calling basic_publish.
$this->Channel->basic_publish($msg, $exchangeName);
$this->Channel->wait_for_pending_acks(2);
However, the service was getting stuck when the queue was blocked.
I review the code under the wait_for_pending_ackss hood and I found it:
while (count($this->published_messages) !== 0) {
if ($timeout > 0) {
$this->wait($functions, true, $timeout);
} else {
$this->wait($functions);
}
}
Going deeper into wait method:
public function wait($allowed_methods = null, $non_blocking = false, $timeout = 0)
{
$this->debug->debug_allowed_methods($allowed_methods);
$deferred = $this->process_deferred_methods($allowed_methods);
if ($deferred['dispatch'] === true) {
return $this->dispatch_deferred_method($deferred['queued_method']);
}
// timeouts must be deactivated for non-blocking actions
if (true === $non_blocking) {
$timeout = null;
}
As you can see, no matter which value I pass as $timeout, it will be changed to null by wait method because it always pass true as $non_blocking argument.
I changed the second argument passed by wait and it worked. But I don't know what it implies to the rest of the process.
RABBITMQ_VM_MEMORY_HIGH_WATERMARK=10MiB https://hub.docker.com/_/rabbitmq)
wait_for_pending_acks methods throw an error after N seconds
wait_for_pending_acks stucks until RabbitQM connection gets unblocked OR the connection be interrupted.
Hi @rubens21, thanks for reporting. Looks like yes, functions wait_for_pending_acks and wait_for_pending_acks_returns incorrectly calls wait(). Should be quite high CPU usage in Your case.
Fixed by #733
Most helpful comment
Fixed by #733