Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
From 41bc1097c65a402355dc2b0b9402811a78389b63 Mon Sep 17 00:00:00 2001
From: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
Date: Wed, 20 Sep 2023 17:41:33 +0200
Subject: [PATCH] Fix exit condition of TestQuerierIndexQueriesRace

The test was introduced in # but was changed during the code review and not reran with the faulty code since then.

Closes #

Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
---
tsdb/querier_test.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tsdb/querier_test.go b/tsdb/querier_test.go
index 8cfd5d141..2c5ff7477 100644
--- a/tsdb/querier_test.go
+++ b/tsdb/querier_test.go
@@ -2248,7 +2248,7 @@ func TestQuerierIndexQueriesRace(t *testing.T) {
func appendSeries(t *testing.T, ctx context.Context, wg *sync.WaitGroup, h *Head) {
defer wg.Done()

- for i := 0; ctx.Err() != nil; i++ {
+ for i := 0; ctx.Err() == nil; i++ {
app := h.Appender(context.Background())
_, err := app.Append(0, labels.FromStrings(labels.MetricName, "metric", "n", strconv.Itoa(i), "m", "0"), 0, 0)
require.NoError(t, err)
--
2.33.8

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
From 0e66dc19b9f93c247dd938f8099626573df0e998 Mon Sep 17 00:00:00 2001
From: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
Date: Thu, 21 Sep 2023 12:30:08 +0200
Subject: [PATCH] Improve sensitivity of TestQuerierIndexQueriesRace

Currently, the two goroutines race against each other and it's possible that the main test goroutine finishes way earlier than appendSeries has had a chance to run at all.

I tested this change by breaking the code that X fixed and running the race test 100 times. Without the additional time.Sleep the test failed 11 times. With the sleep it failed 65 out of the 100 runs. Which is still not ideal, but it's a step forward.

Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
---
tsdb/querier_test.go | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/tsdb/querier_test.go b/tsdb/querier_test.go
index 2c5ff7477..4938443c2 100644
--- a/tsdb/querier_test.go
+++ b/tsdb/querier_test.go
@@ -2221,6 +2221,7 @@ func TestQuerierIndexQueriesRace(t *testing.T) {
for _, c := range testCases {
c := c
t.Run(fmt.Sprintf("%v", c.matchers), func(t *testing.T) {
+ t.Parallel()
db := openTestDB(t, DefaultOptions(), nil)
h := db.Head()
t.Cleanup(func() {
@@ -2240,6 +2241,9 @@ func TestQuerierIndexQueriesRace(t *testing.T) {
values, _, err := q.LabelValues("n", c.matchers...)
require.NoError(t, err)
require.Emptyf(t, values, `label values for label "n" should be empty`)
+
+ // Sleep to give the appends some change to run.
+ time.Sleep(time.Millisecond)
}
})
}
@@ -2256,6 +2260,7 @@ func appendSeries(t *testing.T, ctx context.Context, wg *sync.WaitGroup, h *Head
require.NoError(t, err)

// Throttle down the appends to keep the test somewhat nimble.
+ // Otherwise, we end up appending thousands or millions of samples.
time.Sleep(time.Millisecond)
}
}
--
2.33.8

9 changes: 7 additions & 2 deletions SPECS/prometheus/prometheus.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Summary: Prometheus monitoring system and time series database
Name: prometheus
Version: 2.45.4
Release: 7%{?dist}
Release: 8%{?dist}
License: Apache-2.0
Vendor: Microsoft Corporation
Distribution: Azure Linux
Expand All @@ -22,6 +22,8 @@ Patch1: CVE-2023-45288.patch
Patch2: CVE-2024-6104.patch
Patch3: CVE-2024-24786.patch
Patch4: CVE-2023-44487.patch
Patch5: 0001-Fix-exit-condition-of-TestQuerierIndexQueriesRace.patch
Patch6: 0002-Improve-sensitivity-of-TestQuerierIndexQueriesRace.patch
BuildRequires: golang
BuildRequires: nodejs
BuildRequires: nodejs-npm
Expand Down Expand Up @@ -138,7 +140,10 @@ fi
%doc README.md RELEASE.md documentation

%changelog
* Tue Mar 04 2024 corvus-callidus <108946721+corvus-callidus@users.noreply.github.com> - 2.45.4-7
* Thu Mar 13 2025 Andrew Phelps <anphel@microsoft.com> - 2.45.4-8
- Add patches to fix test reliability issues with TestQuerierIndexQueriesRace

* Tue Mar 04 2025 corvus-callidus <108946721+corvus-callidus@users.noreply.github.com> - 2.45.4-7
- Fix CVE-2023-44487

* Mon Nov 25 2024 Bala <balakumaran.kannan@microsoft.com> - 2.45.4-6
Expand Down
Loading