Skip to content

vault: serve gateway requests off the connector read loop - #24269

Open
prashantkumar1982 wants to merge 1 commit into
developfrom
cre/vault-node-async-gateway-handler
Open

prashantkumar1982 wants to merge 1 commit into
developfrom
cre/vault-node-async-gateway-handler

Conversation

@prashantkumar1982

@prashantkumar1982 prashantkumar1982 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

The gateway connector calls HandleGatewayMessage from the single read loop for each gateway, and the Vault handler served the request inline. A request waiting in authorization, for example while allowlist auth retries a digest that hasn't reached this node yet, held every later request from that gateway behind it.

Changes

  • HandleGatewayMessage serves each request in a goroutine owned by the handler's service engine and returns immediately, as the confidentialrelay handler does.
  • Each request is bounded by a 60 s timeout. That's above the 30 s allowlist retry window, so in-flight retries aren't cut short.
  • The spawn runs inside IfStarted. Messages that arrive before Start or during Close are refused, so Close never waits on a goroutine added after it started waiting.
  • export_test.go exposes the synchronous path as ServeGatewayMessage, so the existing handler tests keep asserting on its result.
  • New test HandleGatewayMessageDoesNotBlockOtherRequests: a request held in authorization doesn't delay the next one. If the handler is made synchronous again, it fails after 5 s.

There's no concurrency cap, matching confidentialrelay. Every request that reaches a node has already been authorized by the gateway.

Requires

None.

Supports

Deployment Validation Steps

  • Node-only change for Vault DON nodes. In staging, run create, update, delete and list through the gateway; responses are unchanged.
  • vault_node_request_success and vault_node_request_internal_error rates stay flat after rollout.

🤖 Generated with Claude Code

The gateway connector calls HandleGatewayMessage from the single read
loop for each gateway, and the Vault handler served the request inline.
A request waiting in authorization, for example while allowlist auth
retries a digest that has not reached this node yet, held every later
request from that gateway behind it.

HandleGatewayMessage now serves each request in a goroutine owned by the
handler's service engine, bounded by a 60s timeout that stays above the
allowlist retry window, and returns immediately, as the confidential
relay handler does. Messages that arrive while the handler is not
started are refused, so Close never races new goroutines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

👋 prashantkumar1982, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions

Copy link
Copy Markdown
Contributor

✅ No conflicts with other open PRs targeting develop

@prashantkumar1982

Copy link
Copy Markdown
Contributor Author

/vault-audit

@gati-app

gati-app Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

⚠️ Vault audit complete for 2ccd5847 — 1 blocking finding(s) (CRITICAL/MUST FIX) must be addressed before merge.

📋 View the full report and findings — private tracking issue, visible to chainlink team members only. Resolve blocking findings there with /resolved <FINDING-ID> <reason>.

// waits out the allowlist retry window.
func (h *GatewayHandler) HandleGatewayMessage(ctx context.Context, gatewayID string, req *jsonrpc.Request[json.RawMessage]) error {
return h.eng.IfStarted(func() error {
h.eng.GoCtx(ctx, func(ctx context.Context) {

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.

Are you sure that you want GoCtx here? I think you need to shed the cancellation either with:

Suggested change
h.eng.GoCtx(ctx, func(ctx context.Context) {
h.eng.Go(func(ctx context.Context) {

Or if there are other relevant context values, then:

Suggested change
h.eng.GoCtx(ctx, func(ctx context.Context) {
h.eng.GoCtx(context.WithoutCancel(ctx), func(ctx context.Context) {

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants