Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite10f6f4

Browse files
[FIXED] Panic processing snapshot with nil node/assignment after stream delete (#7588)
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
2 parentse9be22c +c3fe224 commite10f6f4

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

‎server/jetstream_cluster.go‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9290,6 +9290,10 @@ func (mset *stream) processSnapshot(snap *StreamReplicatedState, index uint64) (
92909290
mset.store.FastState(&state)
92919291
sreq:=mset.calculateSyncRequest(&state,snap,index)
92929292

9293+
ifmset.sa==nil||mset.node==nil {
9294+
mset.mu.Unlock()
9295+
returnerrCatchupStreamStopped
9296+
}
92939297
s,js,subject,n,st:=mset.srv,mset.js,mset.sa.Sync,mset.node,mset.cfg.Storage
92949298
qname:=fmt.Sprintf("[ACC:%s] stream '%s' snapshot",mset.acc.Name,mset.cfg.Name)
92959299
mset.mu.Unlock()

‎server/jetstream_cluster_3_test.go‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6493,3 +6493,31 @@ func TestJetStreamClusterCorruptMetaSnapshot(t *testing.T) {
64936493
s.Start()
64946494
require_Equal(t,s.numRaftNodes(),0)
64956495
}
6496+
6497+
funcTestJetStreamClusterProcessSnapshotPanicAfterStreamDelete(t*testing.T) {
6498+
s:=RunBasicJetStreamServer(t)
6499+
defers.Shutdown()
6500+
6501+
nc,js:=jsClientConnect(t,s)
6502+
defernc.Close()
6503+
6504+
_,err:=js.AddStream(&nats.StreamConfig{Name:"TEST"})
6505+
require_NoError(t,err)
6506+
6507+
mset,err:=s.globalAccount().lookupStream("TEST")
6508+
require_NoError(t,err)
6509+
mset.mu.RLock()
6510+
sa,node:=mset.sa,mset.node
6511+
mset.mu.RUnlock()
6512+
require_True(t,sa==nil)
6513+
require_True(t,node==nil)
6514+
require_Error(t,mset.processSnapshot(&StreamReplicatedState{},0),errCatchupStreamStopped)
6515+
6516+
mset.setStreamAssignment(&streamAssignment{})// If the stream assignment is set, but the node is nil.
6517+
mset.mu.RLock()
6518+
sa,node=mset.sa,mset.node
6519+
mset.mu.RUnlock()
6520+
require_True(t,sa!=nil)
6521+
require_True(t,node==nil)
6522+
require_Error(t,mset.processSnapshot(&StreamReplicatedState{},0),errCatchupStreamStopped)
6523+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp