yesodweb / persistent

Persistence interface for Haskell allowing multiple storage methods.
MIT License
467 stars 297 forks source link

`selectSourceRes` is not thread-safe with sqlite? #1529

Open NorfairKing opened 8 months ago

NorfairKing commented 8 months ago

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.

parsonsmatt commented 8 months ago

This may be related to this: https://github.com/yesodweb/persistent/issues/981