Skip to content

Conversation

goedderz
Copy link
Member

@goedderz goedderz commented Aug 28, 2025

Scope & Purpose

A use-after-free in prepareQuery, introduced in #21080.

Since #21080, Query::prepareQuery is a coroutine, but its caller Query::execute still returns WAITING for suspension. This was translated, so that prepareQuery finished caused a wakeup, resuming execute. Mostly, no other wakeups can occur during that time; but for a kill, which can trigger a wakeup if the query has DBServer snippets, and cause the query to be destroyed while prepareQuery is still running.

In this PR, Query::execute is refactored into a coroutine to prevent this race. The WAITING->coro glue code is therefore moved from the RestCursorHandler into execute. Additional cases for synchronous calls (Query::executeSync) are now necessary in the same places, to avoid needing additional threads.

  • 💩 Bugfix

Checklist

  • Tests
    • Regression tests

There was no release since its introduction, so no changelog entry nor backports.

  • 📖 CHANGELOG entry made
  • Backports

Related Information

@goedderz goedderz self-assigned this Aug 28, 2025
@cla-bot cla-bot bot added the cla-signed label Aug 28, 2025
@goedderz goedderz marked this pull request as ready for review September 2, 2025 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant