Skip to content

Commit c9b88e4

Browse files
committed
internal/warpc: Fix SIGSEGV in Close() when dispatcher fails to start
Only set started=true when Start() succeeds, so Close() doesn't attempt to close a nil dispatcher. Fixes #14536
1 parent 54c8048 commit c9b88e4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

internal/warpc/warpc.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,8 +776,10 @@ func (d *lazyDispatcher[Q, R]) start() (Dispatcher[Q, R], error) {
776776
d.startOnce.Do(func() {
777777
start := time.Now()
778778
d.dispatcher, d.startErr = Start[Q, R](d.opts)
779-
d.started = true
780-
d.opts.Infof("started dispatcher in %s", time.Since(start))
779+
if d.startErr == nil {
780+
d.started = true
781+
d.opts.Infof("started dispatcher in %s", time.Since(start))
782+
}
781783
})
782784
return d.dispatcher, d.startErr
783785
}

0 commit comments

Comments
 (0)