Skip to content

Race when concurrently appending m2m association when preloaded model #5801

@YeahItsMeAgain

Description

@YeahItsMeAgain

GORM Playground Link

go-gorm/playground#534

Description

I tried appending to a m2m association inside a concurrent goroutines and for some reason it appended only some of the data.
While creating a minimal code example to test this i narrowed it down to this:

  • When the model is fetched from the db(previously created) & the associations are preloaded(Preload(clause.Associations)), it fails.
  • If any of this changes the test passes(note the comments in the code)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions