jakubkulhan / bunny

Performant pure-PHP AMQP (RabbitMQ) sync/async (ReactPHP) library
MIT License
706 stars 102 forks source link

Handle disconnections #159

Open WyriHaximus opened 3 months ago

WyriHaximus commented 3 months ago

On my home cluster I use chaoskube to cause chaos on the cluster with the goal to uncover uncovered failure modes. In this case I found that chaoskube killing one of the 3 RabbitMQ pods (a node in RabbitMQ's PoV) where bunny is connected with causes this error:

Fatal error: Uncaught TypeError: Bunny\Connection::awaitConnectionCloseOk(): Return value must be of type Bunny\Protocol\MethodConnectionCloseOkFrame, null returned in /opt/app/vendor/bunny/bunny/src/Connection.php:409
Unhandled promise rejection with FiberError: Cannot switch fibers in current execution context in /opt/app/vendor/react/async/src/SimpleFiber.php:28

For future consideration: For producers we could consider automatically reconnecting.