GORM Playground Link
https://github.com/go-gorm/playground/pull/783
Description
Requirements:
- using sqlite
- setting sqlDB.SetMaxOpenConns
to 1
- setting PrepareStmt
to true
There seems to be a race condition if we have 2 goroutines try to call the same db read at the same time (for the test I have multiple goroutines so the test is more likely to hit the race condition): - one call is in a transaction the other one is not -> FAIL - both calls in a transaction -> SUCCESS - both calls outside of transaction -> SUCCESS
If we set PrepareStmt
to false
it will work as expected