Skip to content

Commit d0477ee

Browse files
authored
fix: initialize gossip after cluster services (#2361)
1 parent de7b2d0 commit d0477ee

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

logs/log1755969060.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Log 1755969060
2+
3+
## Summary
4+
- Reordered `StartMemberAsync` to call `BeginStartAsync` before `StartGossipActorAsync`, ensuring `MemberList` and `Remote` are initialized before gossip starts.
5+
- Added a clarifying comment documenting the dependency.
6+
7+
## Motivation
8+
`StartGossipActorAsync` accessed `MemberList` and the remote block list before they were initialized, leading to intermittent null-reference failures during cluster startup and tests.

src/Proto.Cluster/Cluster.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ private void SubscribeToTopologyEvents() =>
164164
/// </summary>
165165
public async Task StartMemberAsync()
166166
{
167+
await BeginStartAsync(false).ConfigureAwait(false); // ensure MemberList and Remote are initialized
167168
await Gossip.StartGossipActorAsync().ConfigureAwait(false);
168-
await BeginStartAsync(false).ConfigureAwait(false);
169-
//gossiper must be started whenever any topology events starts flowing
169+
// gossiper must be started whenever any topology events starts flowing
170170
await Gossip.StartgossipLoopAsync().ConfigureAwait(false);
171171
MemberList.InitializeTopologyConsensus();
172172
await Provider.StartMemberAsync(this).ConfigureAwait(false);

0 commit comments

Comments
 (0)