yesodweb / yesodweb/persistent
`selectSourceRes` is not thread-safe with sqlite?
Open
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 486
- Forks
- 306
- PR merge metrics
- No merged PRs in 30d
Description
Bug Reports
I'm using LTS 21.22.
I see that sqlite is returning nulls where non-null values are expected when selectSourceRes is called twice at the same time:
test/Smos/Server/Handler/GetBookingSlotsSpec.hs:35
✗ 1 Smos.Server.Handler.GetBookingSlotsSpec.Does not crash if done twice concurrently
Retries: 3 (does not look flaky)
Failed after 1 tests
PersistMarshalError "selectSourceRes: Couldn't parse field `user` from table `server_file`. Failed to parse Haskell type `Int64`; expected integer from database, but received: PersistNull. Potential solution: Check that your database schema matches your Persistent model definitions., vals: [PersistNull,PersistNull,PersistNull,PersistNull,PersistNull]"
I don't have a minimal repro yet.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with test/Smos/Server/Handler/GetBookingSlotsSpec.hs:35 and reproduce the concurrent failure described in the report. Then trace the selectSourceRes call and SQLite interaction; done means the test no longer returns unexpected PersistNull values when the operation runs twice concurrently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell, sqlite
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100