Skip to content

Addressing inference timeout issues on inference operator tests#154972

Open
pmpailis wants to merge 4 commits into
elastic:mainfrom
pmpailis:fix_154866_addressing_inference_timeout_issues_on_inference_operator_tests
Open

Addressing inference timeout issues on inference operator tests#154972
pmpailis wants to merge 4 commits into
elastic:mainfrom
pmpailis:fix_154866_addressing_inference_timeout_issues_on_inference_operator_tests

Conversation

@pmpailis

Copy link
Copy Markdown
Contributor

There seems be a race condition for when an inference request fails. Assume the following scenario:

When a bulk inference operation fails, completeIfFinished() invokes the completion listener under the checkpoint lock, which releases the request iterator and its backing input block (via ActionListener.releaseBefore(requests, listener) in performAsync). Then, the driver thread keeps polling the re-queued operation via pollNextRequest(), which checks hasFailure() || completed.get() before acquiring the checkpoint lock, so the check could be stale:

E.g.:

  1. Driver thread passes the guard (no failure yet) and blocks on synchronized (checkpoint).
  2. A response thread fails the operation, takes the lock, releases the block, releases the lock.
  3. Driver thread acquires the lock and calls requestItemIterator.next() on the released block.

Reading the released block trips a MockBigArrays assertion on the driver thread. Since that's an AssertionError (not caught by performAsync's catch (Exception e)), it kills the driver and the operation never completes, which the test observes as a timeout.

So in this PR, we simply reuse the check outside the lock, to ensure that the operation is still valid.

Closes #154866

@pmpailis pmpailis added >bug auto-backport Automatically create backport pull requests when merged :Search Relevance/ES|QL Search functionality in ES|QL v9.5.1 v9.4.5 labels Jul 24, 2026
@elasticsearchmachine elasticsearchmachine added v9.6.0 Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch labels Jul 24, 2026
@elasticsearchmachine

Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-search-relevance (Team:Search Relevance)

@elasticsearchmachine

Copy link
Copy Markdown
Collaborator

Hi @pmpailis, I've created a changelog YAML for you.

@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

🔍 Preview links for changed docs

⏳ Building and deploying preview... View progress

This comment will be updated with preview links when the build is complete.

@github-actions

Copy link
Copy Markdown
Contributor

ℹ️ Important: Docs version tagging

👋 Thanks for updating the docs! Just a friendly reminder that our docs are now cumulative. This means all 9.x versions are documented on the same page and published off of the main branch, instead of creating separate pages for each minor version.

We use applies_to tags to mark version-specific features and changes.

Expand for a quick overview

When to use applies_to tags:

✅ At the page level to indicate which products/deployments the content applies to (mandatory)
✅ When features change state (e.g. preview, ga) in a specific version
✅ When availability differs across deployments and environments

What NOT to do:

❌ Don't remove or replace information that applies to an older version
❌ Don't add new information that applies to a specific version without an applies_to tag
❌ Don't forget that applies_to tags can be used at the page, section, and inline level

🤔 Need help?

if (requestItemIterator.hasNext() == false) {
// Re-check under the lock: completeIfFinished() releases the request iterator (and its backing block) while holding
// this lock when a failure occurs. Without re-checking, a concurrent poller that passed the guard above could invoke
// requestItemIterator.next() on an already-released block. See https://github.com/elastic/elasticsearch/issues/154866

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shoudl we remove mention of the issue here: "#154866" and keep comment general overall.

@mayya-sharipova mayya-sharipova left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix LGTM, but I am not an expert in this area!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged >bug :Search Relevance/ES|QL Search functionality in ES|QL Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch v9.4.5 v9.5.1 v9.6.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] CompletionOperatorTests testInferenceFailure failing

3 participants