Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/deadlock frontend queue #1490

Merged
merged 4 commits into from
Jan 8, 2020
Merged
Changes from 1 commit
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
Prev Previous commit
approximates goroutine test
owen-d committed Jan 8, 2020
commit 3cd157c27d235275279ce1381f71a9833a6329dc
20 changes: 14 additions & 6 deletions pkg/querier/queryrange/split_by_interval_test.go
Original file line number Diff line number Diff line change
@@ -378,12 +378,20 @@ func Test_DoesntDeadlock(t *testing.T) {
ctx := user.InjectOrgID(context.Background(), "1")

startingGoroutines := runtime.NumGoroutine()
res, err := split.Do(ctx, req)
time.Sleep(time.Millisecond) // allow for runtime scheduling to catch up before we check n_goroutines

// goroutines shouldn't blow up across 100 rounds
for i := 0; i < 100; i++ {
res, err := split.Do(ctx, req)
require.NoError(t, err)
require.Equal(t, 1, len(res.(*LokiResponse).Data.Result))
require.Equal(t, n/2, len(res.(*LokiResponse).Data.Result[0].Entries))

}
runtime.GC()
endingGoroutines := runtime.NumGoroutine()
require.NoError(t, err)
require.Equal(t, 1, len(res.(*LokiResponse).Data.Result))
require.Equal(t, n/2, len(res.(*LokiResponse).Data.Result[0].Entries))
require.Equal(t, startingGoroutines, endingGoroutines)

// give runtime a bit of slack when catching up -- this isn't an exact science :(
// Allow for 1% increase in goroutines
require.LessOrEqual(t, endingGoroutines, startingGoroutines*101/100)

}