From 40617edb4b0d582bc594b251528c48053007a05d Mon Sep 17 00:00:00 2001 From: Tobias Grieger Date: Tue, 24 Jan 2023 15:13:19 +0100 Subject: [PATCH] kvserver: don't NPE in poisonInflightLatches I still don't understand how we can get a finished endCmds here, but while I scratch my head we don't need to be collecting CI failures. Touches #86547. Epic: none Release note: None --- pkg/kv/kvserver/replica_raft.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/kv/kvserver/replica_raft.go b/pkg/kv/kvserver/replica_raft.go index d29ca8844c7c..ea9ed9da0700 100644 --- a/pkg/kv/kvserver/replica_raft.go +++ b/pkg/kv/kvserver/replica_raft.go @@ -1361,7 +1361,9 @@ func (r *Replica) poisonInflightLatches(err error) { defer r.mu.Unlock() for _, p := range r.mu.proposals { p.ec.poison() - if p.ec.g.Req.PoisonPolicy == poison.Policy_Error { + // TODO(tbg): find out how `p.ec.done()` can have been called at this point, + // See: https://github.com/cockroachdb/cockroach/issues/86547 + if p.ec.g != nil && p.ec.g.Req.PoisonPolicy == poison.Policy_Error { aErr := roachpb.NewAmbiguousResultError(err) // NB: this does not release the request's latches. It's important that // the latches stay in place, since the command could still apply.