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 panic in TestPartitionOffsetWatcher_Concurrency #7029

Merged
merged 1 commit into from
Jan 2, 2024

Conversation

pracucci
Copy link
Collaborator

@pracucci pracucci commented Jan 2, 2024

What this PR does

Earlier today I merged #6982, which introduces the test TestPartitionOffsetWatcher_Concurrency. The test panics if lastNotifiedOffset == lastWatchedOffset because rand.In63n(0) is not a valid input value:

panic: invalid argument to Int63n

goroutine 1684 [running]:
math/rand.(*Rand).Int63n(0xc000447470, 0x0)
	/usr/local/go/src/math/rand/rand.go:122 +0x125
math/rand.Int63n(0xc0007a4960?)
	/usr/local/go/src/math/rand/rand.go:443 +0x2f
github.com/grafana/mimir/pkg/storage/ingest.TestPartitionOffsetWatcher_Concurrency.func2()
	/__w/mimir/mimir/pkg/storage/ingest/partition_offset_watcher_test.go:231 +0xb8
github.com/grafana/mimir/pkg/storage/ingest.runAsync.func1()
	/__w/mimir/mimir/pkg/storage/ingest/writer_test.go:354 +0x82
created by github.com/grafana/mimir/pkg/storage/ingest.runAsync in goroutine 675
	/__w/mimir/mimir/pkg/storage/ingest/writer_test.go:352 +0xd1

Thanks @dimitarvdimitrov for reporting it.

Which issue(s) this PR fixes or relates to

N/A

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • about-versioning.md updated with experimental features.

Signed-off-by: Marco Pracucci <marco@pracucci.com>
@pracucci pracucci marked this pull request as ready for review January 2, 2024 15:16
@pracucci pracucci requested a review from a team as a code owner January 2, 2024 15:16
Copy link
Contributor

@dimitarvdimitrov dimitarvdimitrov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@pracucci pracucci enabled auto-merge (squash) January 2, 2024 15:27
@pracucci pracucci merged commit 6b9b998 into main Jan 2, 2024
28 checks passed
@pracucci pracucci deleted the fix-TestPartitionOffsetWatcher_Concurrency branch January 2, 2024 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants