From af58ac25f691626deb47a79fd25ef232577d6907 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Wed, 11 Jan 2023 01:19:54 -0800 Subject: [PATCH] lib/vmselectapi: properly calculate query timeout vmselect passes query timeout to vmstorage in seconds. The commit 20e9598254078124b230fcb00e35d404e0f6fe8d treated it as timeout in nanoseconds. Fix this in order to prevent from the following errors under vmstorage load: cannot process vmselect request: cannot execute "search_v7": couldn't start executing the request in 0.000 seconds, since -search.maxConcurrentRequests=... concurrent requests are already executed. --- docs/CHANGELOG.md | 1 + lib/vmselectapi/server.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 6568f5fe5d..c29c822219 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -17,6 +17,7 @@ The following tip changes can be tested by building VictoriaMetrics components f * BUGFIX: return correct query results over time series with gaps. The issue has been introduced in [v1.86.0](https://docs.victoriametrics.com/CHANGELOG.html#v1860). +* BUGFIX: properly take into account the timeout passed by `vmselect` to `vmstorage` during query execution. This issue could result in the following error logs at `vmstorage` under load: `cannot process vmselect request: cannot execute "search_v7": couldn't start executing the request in 0.000 seconds, since -search.maxConcurrentRequests=... concurrent requests are already executed`. The issue has been introduced in [v1.86.0](https://docs.victoriametrics.com/CHANGELOG.html#v1860). ## [v1.86.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.86.0) diff --git a/lib/vmselectapi/server.go b/lib/vmselectapi/server.go index f824269f36..8ef4f4f49d 100644 --- a/lib/vmselectapi/server.go +++ b/lib/vmselectapi/server.go @@ -505,7 +505,7 @@ func (s *Server) processRPCWithConcurrencyLimit(ctx *vmselectRequestCtx, rpcName select { case s.concurrencyLimitCh <- struct{}{}: default: - d := time.Duration(ctx.timeout) + d := time.Duration(ctx.timeout) * time.Second if d > s.limits.MaxQueueDuration { d = s.limits.MaxQueueDuration }