Skip to content

rowexec: tableReader can be accessed after being Released #88964

@yuzefovich

Description

@yuzefovich

Found when working on #88608.

Currently we have an issue where a tableReader (the only row-by-row processor allocation of which is sync.Pooled) can be accessed even after it has been Released. In particular, this could occur if the tableReader is part of the subquery tree with rowSourceToPlanNode adapter having it as input. We defer the closure of the subquery planNode tree until after the main query is executed, and rowSourceToPlanNode.Close calls ConsumerClosed on its input. However, the processors from the subquery are released when the subquery execution finishes, so that ConsumerClosed call can occur on a processor that was already put back into the pool (and possibly even picked up from the pool by another query).

This is a very old issue (dating at least to #38866), and with the move to the vectorized engine we are now unlikely to use the table reader processor. However, #88608 wanted to pool more processors, so the issue becomes more pressing.

Jira issue: CRDB-20057

Metadata

Metadata

Assignees

Labels

C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.T-sql-queriesSQL Queries Team

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions