{"record":{"id":"0d8b99a46c2b29ca","repo":"hyperledger/fabric","slug":"this-instance-should-not-be-used-after-calling-don","errorCode":null,"errorMessage":"this instance should not be used after calling Done()","messagePattern":"this instance should not be used after calling Done\\(\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/ledger/kvledger/txmgmt/txmgr/query_executor.go","lineNumber":381,"sourceCode":"// Done implements method in interface `ledger.QueryExecutor`\nfunc (q *queryExecutor) Done() {\n\tlogger.Debugf(\"Done with transaction simulation / query execution [%s]\", q.txid)\n\tif q.doneInvoked {\n\t\treturn\n\t}\n\n\tdefer func() {\n\t\tq.txmgr.commitRWLock.RUnlock()\n\t\tq.doneInvoked = true\n\t\tfor _, itr := range q.itrs {\n\t\t\titr.Close()\n\t\t}\n\t}()\n}\n\nfunc (q *queryExecutor) checkDone() error {\n\tif q.doneInvoked {\n\t\treturn errors.New(\"this instance should not be used after calling Done()\")\n\t}\n\treturn nil\n}\n\nfunc (q *queryExecutor) validateCollName(ns, coll string) error {\n\treturn q.collNameValidator.validateCollName(ns, coll)\n}\n\n// resultsItr implements interface ledger.ResultsIterator\n// this wraps the actual db iterator and intercept the calls\n// to build rangeQueryInfo in the ReadWriteSet that is used\n// for performing phantom read validation during commit\ntype resultsItr struct {\n\tns                      string\n\tendKey                  string\n\tdbItr                   statedb.ResultsIterator\n\trwSetBuilder            *rwsetutil.RWSetBuilder\n\trangeQueryInfo          *kvrwset.RangeQueryInfo","sourceCodeStart":363,"sourceCodeEnd":399,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/ledger/kvledger/txmgmt/txmgr/query_executor.go#L363-L399","documentation":"checkDone detected the query executor was used after Done() was called. Once Done releases the read lock and closes iterators, the executor is invalid — using it indicates a lifecycle bug or double-Done in caller code.","triggerScenarios":"Thrown at core/ledger/kvledger/txmgmt/txmgr/query_executor.go:381 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Do not reuse a query executor after Done()","Obtain a fresh executor for subsequent queries","Fix caller logic that retains the executor past Done"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}