Repository navigation
vault: serve gateway requests off the connector read loop - #24269
prashantkumar1982 wants to merge 1 commit into
Conversation
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>
|
👋 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! |
|
✅ No conflicts with other open PRs targeting |
|
/vault-audit |
|
📋 View the full report and findings — private tracking issue, visible to chainlink team members only. Resolve blocking findings there with |
| // 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) { |
There was a problem hiding this comment.
Are you sure that you want GoCtx here? I think you need to shed the cancellation either with:
| h.eng.GoCtx(ctx, func(ctx context.Context) { | |
| h.eng.Go(func(ctx context.Context) { |
Or if there are other relevant context values, then:
| h.eng.GoCtx(ctx, func(ctx context.Context) { | |
| h.eng.GoCtx(context.WithoutCancel(ctx), func(ctx context.Context) { |
The gateway connector calls
HandleGatewayMessagefrom 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
HandleGatewayMessageserves each request in a goroutine owned by the handler's service engine and returns immediately, as theconfidentialrelayhandler does.IfStarted. Messages that arrive beforeStartor duringCloseare refused, soClosenever waits on a goroutine added after it started waiting.export_test.goexposes the synchronous path asServeGatewayMessage, so the existing handler tests keep asserting on its result.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
vault_node_request_successandvault_node_request_internal_errorrates stay flat after rollout.🤖 Generated with Claude Code