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

data race with cycle relation #752

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

data race with cycle relation #752

wants to merge 2 commits into from

Conversation

zwell
Copy link

@zwell zwell commented Jul 17, 2024

CGO_ENABLED=1 GORM_DIALECT=mysql go test -race
==================
WARNING: DATA RACE
Read at 0x00c0005f2150 by goroutine 26:
  gorm.io/gorm/schema.(*Schema).guessRelation()
      E:/work/code/source/playground/gorm/schema/relationship.go:553 +0x1e44
  gorm.io/gorm/schema.(*Schema).parseRelation()
      E:/work/code/source/playground/gorm/schema/relationship.go:95 +0x744
  gorm.io/gorm/schema.ParseWithSpecialTableName()
      E:/work/code/source/playground/gorm/schema/schema.go:350 +0x4164
  gorm.io/gorm.(*Statement).ParseWithSpecialTableName()
      E:/work/code/source/playground/gorm/statement.go:493 +0x146
  gorm.io/gorm.(*Statement).Parse()
      E:/work/code/source/playground/gorm/statement.go:489 +0x3ab
  gorm.io/gorm.(*processor).Execute()
      E:/work/code/source/playground/gorm/callbacks.go:105 +0x386
  gorm.io/gorm.(*DB).First()
      E:/work/code/source/playground/gorm/finisher_api.go:129 +0x2f8
  gorm.io/playground.TestGORM.func2()
      E:/work/code/source/playground/main_test.go:23 +0xa4

Previous write at 0x00c0005f2150 by goroutine 25:
  gorm.io/gorm/schema.ParseWithSpecialTableName()
      E:/work/code/source/playground/gorm/schema/schema.go:365 +0x46b3
  gorm.io/gorm.(*Statement).ParseWithSpecialTableName()
      E:/work/code/source/playground/gorm/statement.go:493 +0x146
  gorm.io/gorm.(*Statement).Parse()
      E:/work/code/source/playground/gorm/statement.go:489 +0x3ab
  gorm.io/gorm.(*processor).Execute()
      E:/work/code/source/playground/gorm/callbacks.go:105 +0x386
  gorm.io/gorm.(*DB).First()
      E:/work/code/source/playground/gorm/finisher_api.go:129 +0x2f8
  gorm.io/playground.TestGORM.func1()
      E:/work/code/source/playground/main_test.go:16 +0xa4

Goroutine 26 (running) created at:
  gorm.io/playground.TestGORM()
      E:/work/code/source/playground/main_test.go:21 +0x4e
  testing.tRunner()
      D:/Golang/sdk/go1.22.3/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      D:/Golang/sdk/go1.22.3/src/testing/testing.go:1742 +0x44

Goroutine 25 (running) created at:
  gorm.io/playground.TestGORM()
      E:/work/code/source/playground/main_test.go:14 +0x2c
  testing.tRunner()
      D:/Golang/sdk/go1.22.3/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      D:/Golang/sdk/go1.22.3/src/testing/testing.go:1742 +0x44
==================
==================
WARNING: DATA RACE
Read at 0x00c0005f2168 by goroutine 26:
  gorm.io/gorm/schema.(*Schema).guessRelation()
      E:/work/code/source/playground/gorm/schema/relationship.go:553 +0x1e44
  gorm.io/gorm/schema.(*Schema).parseRelation()
      E:/work/code/source/playground/gorm/schema/relationship.go:95 +0x744
  gorm.io/gorm/schema.ParseWithSpecialTableName()
      E:/work/code/source/playground/gorm/schema/schema.go:350 +0x4164
  gorm.io/gorm.(*Statement).ParseWithSpecialTableName()
      E:/work/code/source/playground/gorm/statement.go:493 +0x146
  gorm.io/gorm.(*Statement).Parse()
      E:/work/code/source/playground/gorm/statement.go:489 +0x3ab
  gorm.io/gorm.(*processor).Execute()
      E:/work/code/source/playground/gorm/callbacks.go:105 +0x386
  gorm.io/gorm.(*DB).First()
      E:/work/code/source/playground/gorm/finisher_api.go:129 +0x2f8
  gorm.io/playground.TestGORM.func2()
      E:/work/code/source/playground/main_test.go:23 +0xa4

Previous write at 0x00c0005f2168 by goroutine 25:
  gorm.io/gorm/schema.ParseWithSpecialTableName()
      E:/work/code/source/playground/gorm/schema/schema.go:369 +0x489b
  gorm.io/gorm.(*Statement).ParseWithSpecialTableName()
      E:/work/code/source/playground/gorm/statement.go:493 +0x146
  gorm.io/gorm.(*Statement).Parse()
      E:/work/code/source/playground/gorm/statement.go:489 +0x3ab
  gorm.io/gorm.(*processor).Execute()
      E:/work/code/source/playground/gorm/callbacks.go:105 +0x386
  gorm.io/gorm.(*DB).First()
      E:/work/code/source/playground/gorm/finisher_api.go:129 +0x2f8
  gorm.io/playground.TestGORM.func1()
      E:/work/code/source/playground/main_test.go:16 +0xa4

Goroutine 26 (running) created at:
  gorm.io/playground.TestGORM()
      E:/work/code/source/playground/main_test.go:21 +0x4e
  testing.tRunner()
      D:/Golang/sdk/go1.22.3/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      D:/Golang/sdk/go1.22.3/src/testing/testing.go:1742 +0x44

Goroutine 25 (running) created at:
  gorm.io/playground.TestGORM()
      E:/work/code/source/playground/main_test.go:14 +0x2c
  testing.tRunner()
      D:/Golang/sdk/go1.22.3/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      D:/Golang/sdk/go1.22.3/src/testing/testing.go:1742 +0x44
==================
==================
WARNING: DATA RACE
Read at 0x00c0005f2180 by goroutine 26:
  gorm.io/gorm/schema.(*Schema).guessRelation()
      E:/work/code/source/playground/gorm/schema/relationship.go:553 +0x1e44
  gorm.io/gorm/schema.(*Schema).parseRelation()
      E:/work/code/source/playground/gorm/schema/relationship.go:95 +0x744
  gorm.io/gorm/schema.ParseWithSpecialTableName()
      E:/work/code/source/playground/gorm/schema/schema.go:350 +0x4164
  gorm.io/gorm.(*Statement).ParseWithSpecialTableName()
      E:/work/code/source/playground/gorm/statement.go:493 +0x146
  gorm.io/gorm.(*Statement).Parse()
      E:/work/code/source/playground/gorm/statement.go:489 +0x3ab
  gorm.io/gorm.(*processor).Execute()
      E:/work/code/source/playground/gorm/callbacks.go:105 +0x386
  gorm.io/gorm.(*DB).First()
      E:/work/code/source/playground/gorm/finisher_api.go:129 +0x2f8
  gorm.io/playground.TestGORM.func2()
      E:/work/code/source/playground/main_test.go:23 +0xa4

Previous write at 0x00c0005f2180 by goroutine 25:
  gorm.io/gorm/schema.ParseWithSpecialTableName()
      E:/work/code/source/playground/gorm/schema/schema.go:373 +0x4a7b
  gorm.io/gorm.(*Statement).ParseWithSpecialTableName()
      E:/work/code/source/playground/gorm/statement.go:493 +0x146
  gorm.io/gorm.(*Statement).Parse()
      E:/work/code/source/playground/gorm/statement.go:489 +0x3ab
  gorm.io/gorm.(*processor).Execute()
      E:/work/code/source/playground/gorm/callbacks.go:105 +0x386
  gorm.io/gorm.(*DB).First()
      E:/work/code/source/playground/gorm/finisher_api.go:129 +0x2f8
  gorm.io/playground.TestGORM.func1()
      E:/work/code/source/playground/main_test.go:16 +0xa4

Goroutine 26 (running) created at:
  gorm.io/playground.TestGORM()
      E:/work/code/source/playground/main_test.go:21 +0x4e
  testing.tRunner()
      D:/Golang/sdk/go1.22.3/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      D:/Golang/sdk/go1.22.3/src/testing/testing.go:1742 +0x44

Goroutine 25 (running) created at:
  gorm.io/playground.TestGORM()
      E:/work/code/source/playground/main_test.go:14 +0x2c
  testing.tRunner()
      D:/Golang/sdk/go1.22.3/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      D:/Golang/sdk/go1.22.3/src/testing/testing.go:1742 +0x44
==================

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.

1 participant