From 010e8e1a60c22365e0bdef42986f1e1ee7679bf8 Mon Sep 17 00:00:00 2001 From: Travis Bischel Date: Mon, 28 Feb 2022 12:59:47 -0700 Subject: [PATCH] txn: fix panic in GroupTransactSession.End Introduced in a059901 in v1.3.0, if TxnOffsetCommit fails, resp will be nil and error will be non-nil. --- pkg/kgo/txn.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/kgo/txn.go b/pkg/kgo/txn.go index 79fb2bb8..0e9064f3 100644 --- a/pkg/kgo/txn.go +++ b/pkg/kgo/txn.go @@ -271,12 +271,12 @@ func (s *GroupTransactSession) End(ctx context.Context, commit TransactionEndTry committed := make(chan struct{}) g = s.cl.commitTransactionOffsets(context.Background(), postcommit, func(_ *kmsg.TxnOffsetCommitRequest, resp *kmsg.TxnOffsetCommitResponse, err error) { - kip447 = resp.Version >= 3 defer close(committed) if err != nil { commitErrs = append(commitErrs, err.Error()) return } + kip447 = resp.Version >= 3 for _, t := range resp.Topics { for _, p := range t.Partitions {