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

chore: fix race condition in cron tests #1369

Merged
merged 1 commit into from
May 1, 2024

Conversation

matt2e
Copy link
Collaborator

@matt2e matt2e commented May 1, 2024

mockDal's attemptCountMap was being read without getting a lock

@matt2e matt2e requested a review from a team as a code owner May 1, 2024 00:29
@matt2e matt2e requested review from deniseli and removed request for a team May 1, 2024 00:29
@alecthomas alecthomas mentioned this pull request May 1, 2024
Copy link
Collaborator

@alecthomas alecthomas left a comment

Choose a reason for hiding this comment

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

I ended up skipping two tests just in case you missed that

@matt2e matt2e force-pushed the matt2e/hash-ring-race-condition branch from 616c811 to 7282299 Compare May 1, 2024 00:33
@matt2e matt2e linked an issue May 1, 2024 that may be closed by this pull request
@matt2e matt2e requested a review from alecthomas May 1, 2024 00:38
@matt2e
Copy link
Collaborator Author

matt2e commented May 1, 2024

That second test isn't failing for me with -race, and github's testing seems to concur.

$ go clean -testcache
$ go test -run TestServiceWithMockDal ./... -race
...
ok  	github.com/TBD54566975/ftl/backend/controller/cronjobs	2.052s

@@ -21,7 +21,6 @@ import (
)

func TestServiceWithMockDal(t *testing.T) {
t.Skip("TODO(matt2e): Fails -race, fix me")
Copy link
Collaborator

Choose a reason for hiding this comment

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

This one sometimes fails - you'll likely need to run it multiple times to reproduce.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ahh, ok will retry more times

@matt2e matt2e force-pushed the matt2e/hash-ring-race-condition branch from 7282299 to cc33f6b Compare May 1, 2024 00:46
@matt2e matt2e changed the title chore: fix race condition in TestHashRing chore: fix race condition in cron tests May 1, 2024
@matt2e matt2e requested a review from alecthomas May 1, 2024 00:55
@matt2e matt2e merged commit 5990462 into main May 1, 2024
10 checks passed
@matt2e matt2e deleted the matt2e/hash-ring-race-condition branch May 1, 2024 00:55
@matt2e
Copy link
Collaborator Author

matt2e commented May 1, 2024

@alecthomas found the issue

@deniseli deniseli added the approved Marks an already closed PR as approved label May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Marks an already closed PR as approved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TestHashRing+TestServiceWithMockDal fail go test -race
3 participants