yesodweb / yesodweb/persistent

`selectSourceRes` is not thread-safe with sqlite?

Open
#1,529 1 comment 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.