Skip to content

Commit 70ff4c9

Browse files
committed
fix self-Join nil-map panic by skipping local PID in Join and guarding handleVoteReply
1 parent cb77f60 commit 70ff4c9

5 files changed

Lines changed: 11 additions & 4 deletions

File tree

health/example/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module ergo.services/actor/health/example
22

3-
go 1.20
3+
go 1.21
44

55
require (
66
ergo.services/actor/health v0.0.0

health/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module ergo.services/actor/health
22

3-
go 1.20
3+
go 1.21
44

55
require ergo.services/ergo v1.999.321-0.20260323195702-0be2846405c2

leader/leader.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,9 @@ func (l *Actor) BroadcastBootstrap(message any) {
376376
// Join adds a peer to the cluster
377377
// Use this to manually add known peers or for dynamic cluster growth
378378
func (l *Actor) Join(peer gen.ProcessID) {
379+
if peer.Node == l.Node().Name() && peer.Name == l.Name() {
380+
return
381+
}
379382
l.Send(peer, msgVote{
380383
ClusterID: l.clusterID,
381384
Term: l.term,
@@ -509,6 +512,10 @@ func (l *Actor) handleVoteReply(from gen.PID, msg msgVoteReply) error {
509512
return nil
510513
}
511514

515+
if l.votesReceived == nil {
516+
return nil
517+
}
518+
512519
// track this vote
513520
l.votesReceived[from] = true
514521

metrics/example/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module ergo.services/actor/metrics/example
22

3-
go 1.20
3+
go 1.21
44

55
require (
66
ergo.services/actor/metrics v0.0.0

metrics/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module ergo.services/actor/metrics
22

3-
go 1.20
3+
go 1.21
44

55
require (
66
ergo.services/ergo v1.999.321-0.20260323195702-0be2846405c2

0 commit comments

Comments
 (0)