diff --git a/internal/rpc/server_routing_validation_diagnostics.go b/internal/rpc/server_routing_validation_diagnostics.go index 3e51657f..d725ba03 100644 --- a/internal/rpc/server_routing_validation_diagnostics.go +++ b/internal/rpc/server_routing_validation_diagnostics.go @@ -259,8 +259,13 @@ func (s *Server) handleRequest(req *Request) Response { } // Adapter helpers + +// reqCtx returns a context with the server's request timeout applied. +// This prevents request handlers from hanging indefinitely if database +// operations or other internal calls stall (GH#bd-p76kv). func (s *Server) reqCtx(_ *Request) context.Context { - return context.Background() + ctx, _ := context.WithTimeout(context.Background(), s.requestTimeout) + return ctx } func (s *Server) reqActor(req *Request) string {