title: Node doesn't rejoin cluster after being downed
body: <p>I'm using Akka.NET's cluster (1.0.5) functionality to implement a service that consists of a master node that receives requests over HTTP and farms the work out to worker nodes that have joined the cluster.</p>
  
  <p>The idea is to be able to easily accomplish the following:</p>
  
  <ul>
  <li><p>add worker nodes to cluster when demand is high (check)</p></li>
  <li><p>be able to reboot the master node or take it offline (maintentance/misbehaviour/whatever) and have the workers reconnect when it becomes available (check)</p></li>
  <li><p>upgrade/reboot a misbehaving worker and have it reconnect to the master node (<strong>fail!</strong>)</p></li>
  </ul>
  
  <p>The first point works as you'd expect: a new instance (Azure Cloud Service worker role) is spun up, and joins the master - which is also the seed node.</p>
  
  <p>For the second point, all worker nodes have an actor that listens to cluster gossip and it determines if the master node has died. If this is the case, the worker node actor system will be rebooted.</p>
  
  <p>The last point is where I'm stuck. The master node also listens to cluster gossip to determine when a worker has become unreachable (<code>ClusterEvent.UnreachableMember</code>) or is shutting down (Exiting status) and decides if it should be downed. According to what I've understood from documentation, the only way to have a "new" version of the same node rejoin the cluster is to down the old version first.</p>
  
  <p>Unfortunately this doesn't seem to be happening. In the test scenario I ran to reproduce the problem locally in the compute emulator, these were the steps:</p>
  
  <ol>
  <li><p>Start the master node (port 8090)</p></li>
  <li><p>Start the worker node (port 9090)</p></li>
  <li><p>Do some work</p></li>
  <li><p>Kill the worker node abruptly</p></li>
  <li><p>Start the worker node back up</p></li>
  </ol>
  
  <p>Below are relevant snippets from the logs I collected for both nodes during this test:</p>
  
  <hr>
  
  <p><strong>Master:</strong></p>
  
  <p>Worker becomes unreachable:</p>
  
  <pre><code>[WARNING][07/12/2015 20:39:35][Thread 0023][[akka://InventoryService/system/cluster/core/daemon]] Cluster Node [akka.tcp://InventoryService@127.0.0.1:8090] - Marking node(s) as UNREACHABLE [Member(address = akka.tcp://InventoryService@0.0.0.0:9090, status = Up]
  </code></pre>
  
  <p>Master node calls <code>Cluster.Leave()</code> and <code>Cluster.Down()</code> on the worker's address:</p>
  
  <pre><code>[DEBUG][07/12/2015 20:39:35][Thread 0021][[akka://InventoryService/system/cluster/core/daemon]] [Initialized] Received Akka.Cluster.ClusterUserAction+Leave
  [INFO][07/12/2015 20:39:35][Thread 0021][[akka://InventoryService/system/cluster/core/daemon]] Marked address [akka.tcp://InventoryService@0.0.0.0:9090] as Leaving]
  [DEBUG][07/12/2015 20:39:35][Thread 0021][[akka://InventoryService/system/cluster/core/daemon]] [Initialized] Received Akka.Cluster.ClusterUserAction+Down
  [INFO][07/12/2015 20:39:35][Thread 0021][[akka://InventoryService/system/cluster/core/daemon]] Marking unreachable node [akka.tcp://InventoryService@0.0.0.0:9090] as Down
  [DEBUG][07/12/2015 20:39:35][Thread 0020][[akka://InventoryService/system/cluster/core/daemon/heartbeatSender]] Cluster Node [akka.tcp://InventoryService@127.0.0.1:8090] - Heartbeat to [akka.tcp://InventoryService@0.0.0.0:9090]
  [INFO][07/12/2015 20:39:36][Thread 0021][[akka://InventoryService/system/cluster/core/daemon]] Leader is removing unreachable node [akka.tcp://InventoryService@0.0.0.0:9090]
  </code></pre>
  
  <p>Master confirms the old node will no longer be allowed to join (seems to have a bug though, see the first line - <code>gated instead for akka.tcp://InventoryService@0.0.0.0:9090 ms</code>, which I imagine would be the time it is supposed to be gated):</p>
  
  <pre><code>[WARNING][07/12/2015 20:39:36][Thread 0013][remoting] Association to [akka.tcp://InventoryService@0.0.0.0:9090] with unknown UID is reported as quarantined, but address cannot be quarantined without knowing the UID, gated instead for akka.tcp://InventoryService@0.0.0.0:9090 ms
  [DEBUG][07/12/2015 20:39:36][Thread 0015][[akka://InventoryService/system/endpointManager/reliableEndpointWriter-akka.tcp%3a%2f%2fInventoryService%400.0.0.0%3a9090-2/endpointWriter]] Disassociated [akka.tcp://InventoryService@127.0.0.1:8090] -&gt; akka.tcp://InventoryService@0.0.0.0:9090
  [DEBUG][07/12/2015 20:39:36][Thread 0020][[akka://InventoryService/system/cluster/core/daemon]] [Initialized] Received Association to [akka.tcp://InventoryService@0.0.0.0:9090] having UID [1198519768] is irrecoverably failed. UID is now quarantined and all messages to this UID will be delivered to dead letters. Remote actorsystem must be restarted to recover from this situation.
  [WARNING][07/12/2015 20:39:36][Thread 0013][remoting] Association to [akka.tcp://InventoryService@0.0.0.0:9090] having UID [1198519768] is irrecoverably failed. UID is now quarantined and all messages to this UID will be delivered to dead letters. Remote actorsystem must be restarted to recover from this situation.
  </code></pre>
  
  <p>Worker boots and tries to connect to the master:</p>
  
  <pre><code>[DEBUG][07/12/2015 20:40:20][Thread 0013][remoting] Associated [akka.tcp://InventoryService@127.0.0.1:8090] &lt;- akka.tcp://InventoryService@0.0.0.0:9090
  [DEBUG][07/12/2015 20:40:21][Thread 0023][[akka://InventoryService/system/cluster/core/daemon]] [Initialized] Received Akka.Cluster.InternalClusterAction+InitJoin
  [DEBUG][07/12/2015 20:40:21][Thread 0020][[akka://InventoryService/system/cluster/core/daemon]] [Initialized] Received Akka.Cluster.InternalClusterAction+InitJoin
  [DEBUG][07/12/2015 20:40:23][Thread 0021][[akka://InventoryService/system/cluster/core/daemon]] [Initialized] Received Akka.Cluster.InternalClusterAction+InitJoin
  [DEBUG][07/12/2015 20:40:28][Thread 0020][[akka://InventoryService/system/cluster/core/daemon]] [Initialized] Received Akka.Cluster.InternalClusterAction+InitJoin
  [DEBUG][07/12/2015 20:40:33][Thread 0023][[akka://InventoryService/system/cluster/core/daemon]] [Initialized] Received Akka.Cluster.InternalClusterAction+InitJoin
  [DEBUG][07/12/2015 20:40:38][Thread 0022][[akka://InventoryService/system/cluster/core/daemon]] [Initialized] Received Akka.Cluster.InternalClusterAction+InitJoin
  [DEBUG][07/12/2015 20:40:43][Thread 0021][[akka://InventoryService/system/cluster/core/daemon]] [Initialized] Received Akka.Cluster.InternalClusterAction+InitJoin
  [DEBUG][07/12/2015 20:40:48][Thread 0020][[akka://InventoryService/system/cluster/core/daemon]] [Initialized] Received Akka.Cluster.InternalClusterAction+InitJoin
  [DEBUG][07/12/2015 20:40:53][Thread 0023][[akka://InventoryService/system/cluster/core/daemon]] [Initialized] Received Akka.Cluster.InternalClusterAction+InitJoin
  [DEBUG][07/12/2015 20:40:58][Thread 0022][[akka://InventoryService/system/cluster/core/daemon]] [Initialized] Received Akka.Cluster.InternalClusterAction+InitJoin
  [DEBUG][07/12/2015 20:41:03][Thread 0021][[akka://InventoryService/system/cluster/core/daemon]] [Initialized] Received Akka.Cluster.InternalClusterAction+InitJoin
  [DEBUG][07/12/2015 20:41:08][Thread 0021][[akka://InventoryService/system/cluster/core/daemon]] [Initialized] Received Akka.Cluster.InternalClusterAction+InitJoin
  [DEBUG][07/12/2015 20:41:13][Thread 0020][[akka://InventoryService/system/cluster/core/daemon]] [Initialized] Received Akka.Cluster.InternalClusterAction+InitJoin
  [DEBUG][07/12/2015 20:41:18][Thread 0023][[akka://InventoryService/system/cluster/core/daemon]] [Initialized] Received Akka.Cluster.InternalClusterAction+InitJoin
  </code></pre>
  
  <p>What is happening here?</p>
  
  <hr>
  
  <p><strong>Worker:</strong></p>
  
  <p>Booting back up after being killed:</p>
  
  <pre><code>[DEBUG][07/12/2015 20:40:18][Thread 0020][[akka://InventoryService/system/cluster/core/daemon]] [Uninitialized] Received Akka.Cluster.InternalClusterAction+JoinSeedNodes
  [DEBUG][07/12/2015 20:40:18][Thread 0020][[akka://InventoryService/system/cluster/core/daemon]] [Uninitialized] Received Akka.Cluster.InternalClusterAction+Subscribe
  [DEBUG][07/12/2015 20:40:18][Thread 0020][[akka://InventoryService/system/cluster/core/daemon]] [Uninitialized] Received Akka.Cluster.InternalClusterAction+JoinSeedNodes
  [DEBUG][07/12/2015 20:40:20][Thread 0021][[akka://InventoryService/system/cluster/core/daemon]] [Uninitialized] Received Akka.Cluster.InternalClusterAction+Subscribe
  [DEBUG][07/12/2015 20:40:18][Thread 0020][[akka://InventoryService/system/cluster/core/daemon]] [Uninitialized] Received Akka.Cluster.InternalClusterAction+Subscribe
  [DEBUG][07/12/2015 20:40:21][Thread 0015][[akka://InventoryService/system/endpointManager/reliableEndpointWriter-akka.tcp%3a%2f%2fInventoryService%40127.0.0.1%3a8090-1/endpointWriter]] Drained buffer with maxWriteCount: 50, fullBackoffCount: 1,smallBackoffCount: 0, noBackoffCount: 0,adaptiveBackoff: 10000
  </code></pre>
  
  <p>And thats it...nothing else gets written to the log!</p>
  
  <hr>
  
  <p>Full log files:</p>
  
  <ul>
  <li><p>Master: <a href="http://pastebin.com/raw.php?i=WtjEhV1V" rel="nofollow">http://pastebin.com/raw.php?i=WtjEhV1V</a></p></li>
  <li><p>Worker: <a href="http://pastebin.com/raw.php?i=QGPxkqEd" rel="nofollow">http://pastebin.com/raw.php?i=QGPxkqEd</a></p></li>
  </ul>
  
  <p>Master cluster config:</p>
  
  <pre><code>cluster {
      seed-nodes = ["master's address here"]
      roles = [ InventoryServiceMaster, InventoryServiceWorker ]
      failure-detector {
          acceptable-heartbeat-pause = 5s
          threshold = 10.0
      }
  }
  </code></pre>
  
  <p>Worker's config is the same, but only has the <code>InventoryServiceWorker</code> role.</p>
  
  <p>What am I missing here? Is this a configuration problem? (I'm hoping its not a bug - I've seen someone else <a href="https://github.com/akkadotnet/akka.net/issues/1458" rel="nofollow">report a similar problem</a> on Github).</p>
  
  <p>EDIT:</p>
  
  <p>Just to be clear, I'm not using the <code>Akka.dll</code> from Nuget since it contains a serialization bug - I checked ou the current master applied the fix and did a Release build. The logs have debug information because I kept the PDB from the build.</p>
  
  <p>EDIT 2:</p>
  
  <p>In the worker log, after rebooting, the event <code>Akka.Cluster.InternalClusterAction+JoinSeedNodes</code> appears twice because I originally had a manual call to <code>Cluster.JoinSeedNodes()</code>. I've since removed this but the result is still the same.</p>