yesodweb / yesodweb/persistent
SQLite intermittently returns ErrorMisuse
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 486
- Forks
- 306
- PR merge metrics
- No merged PRs in 30d
Description
I am using persistent-sqlite in a servant-server app, and I am intermittently receiving the following error:
SQLite3 returned ErrorMisuse while attempting to perform bind text.
The query in question is as follows:
userRows <- liftPersist $ selectList [ DB.UserDeleted ==. Nothing ] []
I've attempted to re-write the query without success:
userRows <- liftPersist $ select $ from $ \u -> do
where_ $ isNothing $ u ^. DB.UserDeleted
return u
I am currently using withSqliteConn, and switching to withSqlitePool was not successful.
I came across this issue and thought it might be relevant. Additionally, the sqlite documentation states:
The default is SQLITE_THREADSAFE=1 which is safe for use in a multithreaded environment.
Given that this compile-time flag is not referenced in the Cabal file, I don't think the issue is related to threading.
Environment:
FreeBSD poseidon 12.0-RELEASE-p3 FreeBSD 12.0-RELEASE-p3 GENERIC amd64
Version 1.9.3, Git revision 40cf7b37526b86d1676da82167ea8758a854953b (6211 commits) x86_64 hpack-0.31.1
The Glorious Glasgow Haskell Compilation System, version 8.6.5
DEPRECATED: Use ls dependencies instead. Will be removed in next major version.
Cabal 2.4.1.0
QuickCheck 2.12.6.1
StateVar 1.1.1.1
adjunctions 4.4
aeson 1.4.2.0
aeson-compat 0.3.9
ansi-terminal 0.8.2
ansi-wl-pprint 0.6.8.2
appar 0.1.8
array 0.5.3.0
asn1-encoding 0.9.5
asn1-parse 0.9.4
asn1-types 0.3.2
async 2.2.2
attoparsec 0.13.2.2
attoparsec-iso8601 1.0.1.0
auto-update 0.1.4.1
base 4.12.0.0
base-compat 0.10.5
base-orphans 0.8.1
base-unicode-symbols 0.2.3
base64-bytestring 1.0.0.2
basement 0.0.10
bifunctors 5.5.4
binary 0.8.6.0
blaze-builder 0.4.1.0
blaze-html 0.9.1.1
blaze-markup 0.8.2.2
bsb-http-chunked 0.0.0.4
byteable 0.1.1
byteorder 1.0.4
bytestring 0.10.8.2
cabal-doctest 1.0.6
cache 0.1.1.2
call-stack 0.1.0
case-insensitive 1.2.0.11
cereal 0.5.8.1
clock 0.7.2
colour 2.3.5
comonad 5.0.5
concise 0.1.0.1
conduit 1.3.1.1
conduit-extra 1.3.1.1
connection 0.2.8
containers 0.6.0.1
contravariant 1.5.2
cookie 0.4.4
cryptonite 0.25
data-default-class 0.1.2.0
deepseq 1.4.4.0
directory 1.3.3.0
distributive 0.6
dlist 0.8.0.6
easy-file 0.2.2
entropy 0.4.1.4
envy 1.5.1.0
erf 2.0.0.0
esqueleto 3.0.0
exceptions 0.10.2
fast-logger 2.4.15
file-embed 0.0.11
filepath 1.4.2.1
free 5.1.1
ghc-boot-th 8.6.5
ghc-prim 0.5.3
hashable 1.2.7.0
hourglass 0.2.12
http-api-data 0.4
http-client 0.5.14
http-client-tls 0.3.5.3
http-date 0.0.8
http-media 0.7.1.3
http-types 0.12.3
http2 1.6.5
integer-gmp 1.0.2.0
integer-logarithms 1.0.3
invariant 0.5.3
iproute 1.7.7
jose 0.8.0.0
kan-extensions 5.2
lens 4.17.1
lifted-base 0.2.3.12
memory 0.14.18
microlens 0.4.10
microlens-th 0.4.2.3
mime-types 0.1.0.9
mmorph 1.1.3
monad-control 1.0.2.3
monad-logger 0.3.30
monad-loops 0.4.3
monad-time 0.3.1.0
mono-traversable 1.0.11.0
mtl 2.2.2
network 2.8.0.1
network-byte-order 0.0.0.0
network-uri 2.6.1.0
old-locale 1.0.0.7
old-time 1.1.0.3
optparse-applicative 0.14.3.0
parallel 3.2.2.0
parsec 3.1.13.0
path-pieces 0.2.1
pem 0.2.4
persistent 2.9.2
persistent-sqlite 2.9.3
persistent-template 2.5.4
pretty 1.1.3.6
primitive 0.6.4.0
process 1.6.5.0
profunctors 5.3
psqueues 0.2.7.2
quickcheck-instances 0.3.19
quill-api 0.1.0
random 1.1
reflection 2.1.4
resource-pool 0.2.3.2
resourcet 1.2.2
rts 1.0
safe 0.3.17
scientific 0.3.6.2
semigroupoids 5.3.2
semigroups 0.18.5
servant 0.16
servant-auth 0.3.2.0
servant-auth-server 0.4.4.0
servant-client 0.16
servant-client-core 0.16
servant-server 0.16
silently 1.2.5
simple-sendfile 0.2.28
singleton-bool 0.1.4
socks 0.5.6
split 0.2.3.3
stm 2.5.0.0
stm-chans 3.0.0.4
streaming-commons 0.2.1.1
string-conversions 0.4.0.1
tagged 0.8.6
template-haskell 2.14.0.0
text 1.2.3.1
tf-random 0.5
th-abstraction 0.2.11.0
time 1.8.0.2
time-locale-compat 0.1.1.5
tls 1.4.1
transformers 0.5.6.2
transformers-base 0.4.5.2
transformers-compat 0.6.5
typed-process 0.2.4.1
unix 2.7.2.2
unix-compat 0.5.1
unix-time 0.4.5
unliftio 0.2.11
unliftio-core 0.1.2.0
unordered-containers 0.2.9.0
utf8-string 1.0.1.1
uuid-types 1.0.3
vault 0.3.1.2
vector 0.12.0.3
vector-algorithms 0.8.0.1
void 0.7.3
wai 3.2.2
wai-app-static 3.1.6.3
wai-cors 0.2.7
wai-extra 3.0.26
wai-logger 2.3.4
warp 3.2.27
word8 0.1.3
x509 1.7.5
x509-store 1.6.7
x509-system 1.6.6
x509-validation 1.6.11
zlib 0.6.2
3.28.0 2019-04-16 19:49:53 884b4b7e502b4e991677b53971277adfaf0a04a284f8e483e2553d0f83156b50
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 by reproducing the intermittent ErrorMisuse around the persistent-sqlite query using withSqliteConn, then compare behavior with withSqlitePool. Review the referenced esqueleto issue and SQLite threading documentation for relevant context. Done means identifying a reproducible cause and documenting or fixing the persistent-sqlite behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell, sqlite
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100