Open zwell opened 4 months ago
I see this problem too - usually in testing on CircleCI. Because it's a race, it's not 100% reproducible for me.
WARNING: DATA RACE
Write at 0x00c000706450 by goroutine 486:
gorm.io/gorm/schema.(*Schema).guessRelation()
/home/circleci/go/pkg/mod/gorm.io/gorm@v1.25.12/schema/relationship.go:590 +0x121c
gorm.io/gorm/schema.(*Schema).parseRelation()
/home/circleci/go/pkg/mod/gorm.io/gorm@v1.25.12/schema/relationship.go:93 +0x88b
gorm.io/gorm/schema.ParseWithSpecialTableName()
/home/circleci/go/pkg/mod/gorm.io/gorm@v1.25.12/schema/schema.go:342 +0x3ac5
gorm.io/gorm.(*Statement).ParseWithSpecialTableName()
/home/circleci/go/pkg/mod/gorm.io/gorm@v1.25.12/statement.go:493 +0x144
gorm.io/gorm.(*Statement).Parse()
/home/circleci/go/pkg/mod/gorm.io/gorm@v1.25.12/statement.go:489 +0x3cd
gorm.io/gorm.(*processor).Execute()
/home/circleci/go/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:105 +0x3a8
gorm.io/gorm.(*DB).First()
/home/circleci/go/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:129 +0x2e4
github.com/freegle/iznik-server-go/message.GetMessagesByIds.func1.1()
/home/circleci/project/message/message.go:120 +0x184
Previous read at 0x00c000706450 by goroutine 489:
gorm.io/gorm/schema.ParseWithSpecialTableName()
/home/circleci/go/pkg/mod/gorm.io/gorm@v1.25.12/schema/schema.go:341 +0x3a08
gorm.io/gorm.(*Statement).ParseWithSpecialTableName()
/home/circleci/go/pkg/mod/gorm.io/gorm@v1.25.12/statement.go:493 +0x144
gorm.io/gorm.(*Statement).Parse()
/home/circleci/go/pkg/mod/gorm.io/gorm@v1.25.12/statement.go:489 +0xa6
gorm.io/gorm.(*DB).ScanRows()
/home/circleci/go/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:577 +0x6d
gorm.io/gorm.(*DB).Scan()
/home/circleci/go/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:535 +0x3da
github.com/freegle/iznik-server-go/message.GetMessagesByIds.func1.4()
/home/circleci/project/message/message.go:167 +0x1cf
GORM Playground Link
https://github.com/go-gorm/playground/pull/752
Description
In my project, hava some cycle orm relation, I use -race option to test, There is a certain probability that "DATA RACE"
Here are the test results for playgroud