diff --git a/logs/log1755969060.md b/logs/log1755969060.md new file mode 100644 index 0000000000..5f4fc76de6 --- /dev/null +++ b/logs/log1755969060.md @@ -0,0 +1,8 @@ +# Log 1755969060 + +## Summary +- Reordered `StartMemberAsync` to call `BeginStartAsync` before `StartGossipActorAsync`, ensuring `MemberList` and `Remote` are initialized before gossip starts. +- Added a clarifying comment documenting the dependency. + +## Motivation +`StartGossipActorAsync` accessed `MemberList` and the remote block list before they were initialized, leading to intermittent null-reference failures during cluster startup and tests. diff --git a/src/Proto.Cluster/Cluster.cs b/src/Proto.Cluster/Cluster.cs index c1984b5525..2578a922ff 100644 --- a/src/Proto.Cluster/Cluster.cs +++ b/src/Proto.Cluster/Cluster.cs @@ -164,9 +164,9 @@ private void SubscribeToTopologyEvents() => /// public async Task StartMemberAsync() { + await BeginStartAsync(false).ConfigureAwait(false); // ensure MemberList and Remote are initialized await Gossip.StartGossipActorAsync().ConfigureAwait(false); - await BeginStartAsync(false).ConfigureAwait(false); - //gossiper must be started whenever any topology events starts flowing + // gossiper must be started whenever any topology events starts flowing await Gossip.StartgossipLoopAsync().ConfigureAwait(false); MemberList.InitializeTopologyConsensus(); await Provider.StartMemberAsync(this).ConfigureAwait(false);