Incorrect shutdown order
In Orleans 3.1.4 we are seeing that the shutdown process is not graceful. In particular, that the silo that's shutting down is not gossiping to the other silos about its departure, although it correctly writes to the state table that it's "dead". Related to this, we have this message in the logs:
Message was queued for sending after outbound queue was stopped: "Request S10.240.0.4:11111:323587809*stg/15/0000000f@S0000000f->S10.240.0.35:11111:323597363*stg/15/0000000f@S0000000f #61294: "
INF Gossiping "S10.240.0.4:11111:323587809" status change to "Dead" to 2 partners
We're using the AzureBasedMembershipTable with Orleans in Linux containers and we're seeing the problem because the RuntimeIntialize stop callback for Silo gets called before that of MembershipAgent. As a consequence, the outbound queue gets closed before the gossip message can propagate to the other silos and that's causing the gossip notification to time out after 3 seconds. The other silos are then forced to vote for the silo to be declared dead after 3 failed probes.
Setting MembershipAgent to work on the stage RuntimeInitialize+1 just like how ConnectionManagerLifecycleAdapter is set to RuntimeInitialize-1 might fix it.
You are totally right here. Thanks for pointing it out!
In most cases it should be fine since most of our code consider a silo in the ShuttingDown state equal to Dead (like our directory). But it can be an issue in the future (in fact it is one of the issue I am facing with a PR I am working on :))
Let's fix that. The fix should be straightforward, but we need to check if there will be any unexpected issues caused by this fix.
Resolved via #6480.