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: make disableEager not trigger the race detector #746

Merged

Conversation

zepatrik
Copy link
Contributor

After a bit of code search I figured that the race detection mentioned in #723 is kind of a false positive. Adding this check ensures the race detector is not triggered.

@zepatrik zepatrik changed the base branch from main to development July 12, 2022 14:50
@zepatrik zepatrik force-pushed the origin/fix/eager-race-detector branch 2 times, most recently from 107833e to 023aee7 Compare July 12, 2022 15:12
@zepatrik zepatrik marked this pull request as ready for review July 12, 2022 15:16
@@ -533,6 +534,21 @@ func Test_Create_Non_PK_ID(t *testing.T) {
})
}

func Test_Create_Parallel(t *testing.T) {
Copy link
Contributor Author

@zepatrik zepatrik Jul 12, 2022

Choose a reason for hiding this comment

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

As you can see, this test failed first with the data race: https://github.com/gobuffalo/pop/runs/7304729964?check_suite_focus=true#step:6:47

==================
WARNING: DATA RACE
Read at 0x00c000074ca0 by goroutine 103:
  github.com/gobuffalo/pop/v6.(*Connection).Create()
      /home/runner/work/pop/pop/executors.go:176 +0x90
  github.com/gobuffalo/pop/v6.Test_Create_Parallel.func1.1()
      /home/runner/work/pop/pop/executors_test.go:546 +0x147
  testing.tRunner()
      /opt/hostedtoolcache/go/1.18.3/x64/src/testing/testing.go:1439 +0x213
  testing.(*T).Run.func1()
      /opt/hostedtoolcache/go/1.18.3/x64/src/testing/testing.go:1486 +0x47
Previous write at 0x00c000074ca0 by goroutine 80:
  github.com/gobuffalo/pop/v6.(*Connection).disableEager()
      /home/runner/work/pop/pop/connection.go:244 +0xbc
  github.com/gobuffalo/pop/v6.(*Connection).Create()
      /home/runner/work/pop/pop/executors.go:178 +0xa1
  github.com/gobuffalo/pop/v6.Test_Create_Parallel.func1.1()
      /home/runner/work/pop/pop/executors_test.go:546 +0x147
  testing.tRunner()
      /opt/hostedtoolcache/go/1.18.3/x64/src/testing/testing.go:1439 +0x213
  testing.(*T).Run.func1()
      /opt/hostedtoolcache/go/1.18.3/x64/src/testing/testing.go:1486 +0x47

@zepatrik zepatrik force-pushed the origin/fix/eager-race-detector branch from ed5da98 to adc17e5 Compare July 12, 2022 15:28
@zepatrik
Copy link
Contributor Author

OK the tests are still not working, I'll fix them tomorrow...

@zepatrik zepatrik marked this pull request as draft July 12, 2022 16:27
@zepatrik zepatrik force-pushed the origin/fix/eager-race-detector branch from adc17e5 to 1de2d66 Compare July 13, 2022 08:36
@@ -13,7 +13,7 @@ services:
ports:
- "3306:3306"
postgres:
image: postgres:9.6
image: postgres:10.21
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previous test failure was related to some postgres bug. As 9.6 is not supported anymore, I bumped to a supported version.

@zepatrik zepatrik force-pushed the origin/fix/eager-race-detector branch from 1de2d66 to 58adbcc Compare July 13, 2022 08:38
@zepatrik zepatrik marked this pull request as ready for review July 13, 2022 08:41
Copy link
Member

@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

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

Great job, thank you for the extensive test suite!

I agree on bumping PostgreSQL to the least supported version, I don't think anyone will run the 9.x branch.

Also, in the CI we use PostgreSQL 14 so I think this change is acceptable.

@aeneasr aeneasr merged commit 794e524 into gobuffalo:development Jul 13, 2022
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