Compare commits

...

5 Commits

Author SHA1 Message Date
Jayice
3272724422 enrich comments 2026-01-29 14:31:16 +08:00
Jayice
8f973fc61c Merge remote-tracking branch 'origin/issue-10314' into issue-10314
# Conflicts:
#	docs/victoriametrics/changelog/CHANGELOG.md
2026-01-29 14:07:55 +08:00
JAYICE
a7cc076e01 Merge branch 'cluster' into issue-10314
Signed-off-by: JAYICE <1185430411@qq.com>
2026-01-28 22:59:13 +08:00
Jayice
dd92960fa5 make cubic-dev-ai happy 2026-01-28 17:35:11 +08:00
Jayice
d4e72c8257 Limit the minimum number of idle connections from 3 to 1 2026-01-28 15:20:45 +08:00
2 changed files with 8 additions and 4 deletions

View File

@@ -42,6 +42,7 @@ See also [LTS releases](https://docs.victoriametrics.com/victoriametrics/lts-rel
* BUGFIX: [vmagent](https://docs.victoriametrics.com/victoriametrics/vmagent/): apply `-promscrape.maxScrapeSize` check to decompressed data instead of compressed data. See [#9481](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/9481).
* BUGFIX: [vmalert](https://docs.victoriametrics.com/victoriametrics/vmalert/): disallow setting the `-notifier.url` command-line flag to a null value. See [#10355](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/10355).
* BUGFIX: [MetricsQL](https://docs.victoriametrics.com/victoriametrics/metricsql/): fix `changes()` function when gaps between samples exceed the lookbehind window. Previously, it could yield a non-zero value even when the sample value remained unchanged. See [#10280](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/10280).
* BUGFIX: `vmselect` in [VictoriaMetrics cluster](https://docs.victoriametrics.com/victoriametrics/cluster-victoriametrics/): Limit the minimum number of idle connections from 3 to 1. It helps prevent broken connections from remaining for too long and causing failed requests and partial responses during `vmstorage` rolling restart period. See [#10314](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/10314)
## [v1.134.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.134.0)

View File

@@ -236,13 +236,13 @@ func (cp *ConnPool) closeIdleConns() {
// Close connections, which were idle for more than 120 seconds.
// This should reduce the number of connections after sudden spikes in query rate.
// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2508
deadline := fasttime.UnixTimestamp() - 120
deadline := fasttime.UnixTimestamp() - 60
var activeConns []connWithTimestamp
var closeConns []connWithTimestamp
cp.mu.Lock()
// fast path, if there are less than 3 connections in the pool.
if len(cp.conns) < 3 {
// fast path, if there are less than 2 connections in the pool.
if len(cp.conns) < 2 {
cp.mu.Unlock()
return
}
@@ -256,7 +256,10 @@ func (cp *ConnPool) closeIdleConns() {
}
}
for _, c := range closeConns {
if len(activeConns) < 3 {
// It can limit the number of broken connections remaining after the idle timeout to 1,
// preventing failed requests and partial responses caused by too many broken connections after the idle timeout.
// Please see https://github.com/VictoriaMetrics/VictoriaMetrics/issues/10314.
if len(activeConns) < 1 {
activeConns = append(activeConns, c)
continue
}