Skip to content

fix(registry): fix JIT error scoping race#2199

Merged
k8s-ci-robot merged 2 commits into
kubernetes-sigs:mainfrom
LukeAVanDrie:fix/jit
Jan 26, 2026
Merged

fix(registry): fix JIT error scoping race#2199
k8s-ci-robot merged 2 commits into
kubernetes-sigs:mainfrom
LukeAVanDrie:fix/jit

Conversation

@LukeAVanDrie
Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

This PR fixes a race condition where concurrent requests waiting for JIT provisioning could incorrectly proceed with an uninitialized flow if the primary requester failed.

The Bug:

  1. Request A (Winner) calls WithConnection and starts fr.ensureFlowInfrastructure.
  2. Request B (Waiter) blocks on state.initialized.Do.
  3. Request A fails (e.g., dynamic band creation fails). jitErr (local var) is set. WithConnection returns error.
  4. Request B wakes up. state.initialized.Do returns (no-op).
  5. Request B checks its own local jitErr, which is nil because the error was scoped to Request A's stack.
  6. Request B proceeds to use the broken flow state, panic or error ensues.

The Fix:

  • Introduced initErr field to flowState.
  • The result of fr.ensureFlowInfrastructure is now stored on the struct itself.
  • All waiters (Winner and Waiters) check state.initErr after the Do block returns.

Testing:

  • Added TestFlowRegistry_JITErrorScopingwhich deliberately stalls concurrent requests during JIT provisioning and forces a failure.
  • Verified that all concurrent requests now correctly receive the error (previously, N-1 requests would succeed incorrectly).

Which issue(s) this PR fixes:

Followup to @aishukamal's comment here. Thanks for catching this!

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jan 23, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented Jan 23, 2026

Deploy Preview for gateway-api-inference-extension ready!

Name Link
🔨 Latest commit 77e8983
🔍 Latest deploy log https://app.netlify.com/projects/gateway-api-inference-extension/deploys/69779fe1d14fb90008b1ae5f
😎 Deploy Preview https://deploy-preview-2199--gateway-api-inference-extension.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 23, 2026
@LukeAVanDrie
Copy link
Copy Markdown
Contributor Author

/assign @aishukamal

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

@LukeAVanDrie: GitHub didn't allow me to assign the following users: aishukamal.

Note that only kubernetes-sigs members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

Details

In response to this:

/assign @aishukamal

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ahg-g
Copy link
Copy Markdown
Contributor

ahg-g commented Jan 25, 2026

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 25, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahg-g, LukeAVanDrie

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 25, 2026
Concurrent requests waiting on JIT provisioning could bypass error
checks if the primary request failed. Store init error on struct
to ensure all waiters see the failure.
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 26, 2026
@ahg-g
Copy link
Copy Markdown
Contributor

ahg-g commented Jan 26, 2026

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 26, 2026
@k8s-ci-robot k8s-ci-robot merged commit 8c60d23 into kubernetes-sigs:main Jan 26, 2026
11 checks passed
elevran pushed a commit to llm-d/llm-d-router that referenced this pull request Apr 23, 2026
…i-inference-extension#2199)

* fix(registry): fix JIT error scoping race

Concurrent requests waiting on JIT provisioning could bypass error
checks if the primary request failed. Store init error on struct
to ensure all waiters see the failure.

* rebase and resolve conflicts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants