sql: potential nil ctx on connEx.close() #51467
Labels
A-sql-executor
SQL txn logic
C-bug
Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
T-sql-queries
SQL Queries Team
Projects
Spin off from #51460.
I think there's a bug in the
connExecutor
closing code. I think it can lead to crashes, although I'm not sure.Look at what this event does
cockroach/pkg/sql/conn_fsm.go
Lines 368 to 369 in 3639ec5
This event is generated here when the
connExecutor
is closing (i.e. when the pgwire connection is terminated). This event leaves theconnExecutor
instateAborted
but also clearstxnState.Ctx
(throughcleanupAndFinishOnError()
. That's not kosher, sinceconnEx.Ctx()
expects there to be a non-niltxnState.Ctx
whenever the state is notstateNoTxn
. Even though the executor is closing, I don't think this is benign. I think we might try to use that nil ctx and crash.Jira issue: CRDB-4042
The text was updated successfully, but these errors were encountered: