Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rowexec: tableReader can be accessed after being Released #88964

Closed
yuzefovich opened this issue Sep 28, 2022 · 0 comments · Fixed by #88973
Closed

rowexec: tableReader can be accessed after being Released #88964

yuzefovich opened this issue Sep 28, 2022 · 0 comments · Fixed by #88973
Assignees
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-queries SQL Queries Team

Comments

@yuzefovich
Copy link
Member

yuzefovich commented Sep 28, 2022

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

@yuzefovich yuzefovich added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Sep 28, 2022
@yuzefovich yuzefovich self-assigned this Sep 28, 2022
@blathers-crl blathers-crl bot added the T-sql-queries SQL Queries Team label Sep 28, 2022
@craig craig bot closed this as completed in aaca5ce Sep 30, 2022
@mgartner mgartner moved this to Done in SQL Queries Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant