You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tested it on a virtual machine and kept rebooting the program for a minute. There is no problem when I list the association of a table or change the name of the association.
type Info1 struct {
CreatedAt time.Time json:"created_at"
UpdatedAt time.Time json:"updated_at"
We found that two tables, both associated with the same table and with the same name, were called at the same time when the program was started
err = db.Model(&bo.PeInfo{}).Order("id ASC").Find(&Info1List).Error
There's a probability the program will crash
I tested it on a virtual machine and kept rebooting the program for a minute. There is no problem when I list the association of a table or change the name of the association.
type Info1 struct {
CreatedAt time.Time
json:"created_at"
UpdatedAt time.Time
json:"updated_at"
}
type Info2 struct {
CreatedAt time.Time
json:"created_at"
UpdatedAt time.Time
json:"updated_at"
}
The following is the stack information when the program exits
fatal error: concurrent map writes
fatal error: concurrent map writes
goroutine 44 [running]:
gorm.io/gorm/schema.(*Schema).parseRelation(0xc000b190e0, 0xc000b252c0)
vendor/gorm.io/gorm/schema/relationship.go:100 +0x5d8
gorm.io/gorm/schema.ParseWithSpecialTableName({0x134e900, 0xc0009f25a0}, 0xc00073dc40, {0x1b0c068?, 0xc00013ed80?}, {0x0, 0x0})
vendor/gorm.io/gorm/schema/schema.go:341 +0x22c5
gorm.io/gorm.(*Statement).ParseWithSpecialTableName(0xc0009f6380, {0x134e900?, 0xc0009f25a0?}, {0x0?, 0x14f6e00?})
vendor/gorm.io/gorm/statement.go:492 +0x65
gorm.io/gorm.(*Statement).Parse(...)
vendor/gorm.io/gorm/statement.go:488
gorm.io/gorm.(*processor).Execute(0xc0007229b0, 0xc0007eca50?)
vendor/gorm.io/gorm/callbacks.go:105 +0x179
gorm.io/gorm.(*DB).Find(0xc000a10e38?, {0x1367600?, 0xc00093cb40}, {0x0, 0x0, 0x0})
Error code location, is indeed a map write
if relation.FieldSchema != relation.Schema && relation.Polymorphic == nil && field.OwnerSchema == nil {
relation.FieldSchema.Relationships.Relations[""+relation.Schema.Name+""+relation.Name] = relation
}
and my gorm version:
gorm.io/driver/mysql v1.5.2
gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde
Thank you very much!
The text was updated successfully, but these errors were encountered: