sstone / amqp-client

[THIS PROJECT HAS BEEN ARCHIVED AND IS NO LONGER MAINTAINED] Simple fault-tolerant AMQP client written in Scala and based on Akka and the RabbitMQ java client
MIT License
160 stars 88 forks source link

ChannelOwner tries to create forwarder before old one is suspended (forwarder is not unique) #84

Open n1ko-w1ll opened 8 years ago

n1ko-w1ll commented 8 years ago

Hi again,

another issue we found has to do with the forwarder created by the ChannelOwner.

On a Shutdown message in the ChannelOwner, the forwarder is stopped via the context. However, context.stop only guarantees that the suspend message will be the next message the actor gets, but not when it will get it. If the connection is recovered too quickly, the ChannelOwner receives the new Channel before the old forwarder receives the suspend message and the creation of a new forwarder fails with "akka.actor.InvalidActorNameException: actor name [forwarder] is not unique!".

Why does the forwarder actor has to have a defined name at all? As far as I can tell, it is never selected by its name anyway.

Best regards Niko

P.S.: we use the amqp-client_2.11 in version 1.5.

sstone commented 8 years ago

Hi, Well actually I did name it a while back so that problems like this could be easily detected because from a functional point of view it is supposed to be unique :) You're right: it does not need to be named, but for debugging reasons a simple scheme with a randomized name which start with "forwarder" could help, what do you think ? Thanks, Fabrice

n1ko-w1ll commented 8 years ago

Hi Fabrice,

If it would be guaranteed, that the actor was suspended before the next forwarder is created, a unique name is preferrable to (as you said) detect weird problems faster. In this case, a naming scheme with "forwarder" in the actor name might definitely help.

Best regards Niko