commercialhaskell / stack

The Haskell Tool Stack
http://haskellstack.org
BSD 3-Clause "New" or "Revised" License
4k stars 843 forks source link

SQLite3 returned ErrorIO while attempting to perform prepare #5217

Open saurabhnanda opened 4 years ago

saurabhnanda commented 4 years ago

General summary/comments (optional)

Unable to build a project via stack <=> docker integration on Mac OS (which uses Docker Toolbox + VirtualBox). Not completely sure if Mac OS (Docker Toolbox + VirtualBox) is the culprit here, or not.

Removed the pantry sqlite3 file does not fix the problem.

Steps to reproduce

Package should build, as expected.

Actual

[LOCALHOST:~/projects/haskell-aws-lambda/lambda-function (master) saurabhnanda] $ stack build --verbose
Version 2.1.3, Git revision 0fa51b9925decd937e4a993ad90cb686f88fa282 (7739 commits) x86_64 hpack-0.31.2
2020-03-07 13:43:22.406698: [debug] Checking for project config at: /Users/saurabhnanda/projects/haskell-aws-lambda/lambda-function/stack.yaml
2020-03-07 13:43:22.409013: [debug] Loading project config file stack.yaml
2020-03-07 13:43:22.432703: [debug] SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2020-03-06 08:13:22.432644 UTC]
2020-03-07 13:43:22.435817: [debug] Run process: /usr/local/bin/docker --version
2020-03-07 13:43:22.777373: [debug] Process finished in 341ms: /usr/local/bin/docker --version
2020-03-07 13:43:22.777843: [debug] Run process: /usr/local/bin/docker inspect lambda-stack:latest
2020-03-07 13:43:22.886967: [debug] Process finished in 109ms: /usr/local/bin/docker inspect lambda-stack:latest
2020-03-07 13:43:22.888435: [debug] Run process within /Users/saurabhnanda/projects/haskell-aws-lambda/lambda-function/: /usr/local/bin/docker create --net=host -e STACK_IN_CONTAINER=1 -e STACK_ROOT=/Users/saurabhnanda/.stack -e STACK_PLATFORM_VARIANT=dkd84899d27c848778c508c4d3867401cb -e HOME=/Users/saurabhnanda/projects/haskell-aws-lambda/lambda-function/.stack-work/docker/_home -e PATH=/opt/host/bin:/Users/saurabhnanda/projects/haskell-aws-lambda/lambda-function/.stack-work/docker/_home/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -e PWD=/Users/saurabhnanda/projects/haskell-aws-lambda/lambda-function -v /Users/saurabhnanda:/Users/saurabhnanda -v /Users/saurabhnanda/.stack:/Users/saurabhnanda/.stack -v /Users/saurabhnanda/projects/haskell-aws-lambda/lambda-function:/Users/saurabhnanda/projects/haskell-aws-lambda/lambda-function -v /Users/saurabhnanda/projects/haskell-aws-lambda/lambda-function/.stack-work/docker/_home:/Users/saurabhnanda/projects/haskell-aws-lambda/lambda-function/.stack-work/docker/_home -w /Users/saurabhnanda/projects/haskell-aws-lambda/lambda-function -e USER=saurabhnanda -e SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.yTb07VN76h/Listeners -v /private/tmp/com.apple.launchd.yTb07VN76h/Listeners:/private/tmp/com.apple.launchd.yTb07VN76h/Listeners -v /Users/saurabhnanda/.stack/programs/x86_64-linux/stack-2.1.3/stack:/opt/host/bin/stack -t -i lambda-stack:latest /opt/host/bin/stack --internal-re-exec-version=2.1.3 --internal-docker-entrypoint "DockerEntrypoint {deUser = Nothing}" build --verbose
2020-03-07 13:43:23.043190: [debug] Process finished in 154ms: /usr/local/bin/docker create --net=host -e STACK_IN_CONTAINER=1 -e STACK_ROOT=/Users/saurabhnanda/.stack -e STACK_PLATFORM_VARIANT=dkd84899d27c848778c508c4d3867401cb -e HOME=/Users/saurabhnanda/projects/haskell-aws-lambda/lambda-function/.stack-work/docker/_home -e PATH=/opt/host/bin:/Users/saurabhnanda/projects/haskell-aws-lambda/lambda-function/.stack-work/docker/_home/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -e PWD=/Users/saurabhnanda/projects/haskell-aws-lambda/lambda-function -v /Users/saurabhnanda:/Users/saurabhnanda -v /Users/saurabhnanda/.stack:/Users/saurabhnanda/.stack -v /Users/saurabhnanda/projects/haskell-aws-lambda/lambda-function:/Users/saurabhnanda/projects/haskell-aws-lambda/lambda-function -v /Users/saurabhnanda/projects/haskell-aws-lambda/lambda-function/.stack-work/docker/_home:/Users/saurabhnanda/projects/haskell-aws-lambda/lambda-function/.stack-work/docker/_home -w /Users/saurabhnanda/projects/haskell-aws-lambda/lambda-function -e USER=saurabhnanda -e SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.yTb07VN76h/Listeners -v /private/tmp/com.apple.launchd.yTb07VN76h/Listeners:/private/tmp/com.apple.launchd.yTb07VN76h/Listeners -v /Users/saurabhnanda/.stack/programs/x86_64-linux/stack-2.1.3/stack:/opt/host/bin/stack -t -i lambda-stack:latest /opt/host/bin/stack --internal-re-exec-version=2.1.3 --internal-docker-entrypoint "DockerEntrypoint {deUser = Nothing}" build --verbose
2020-03-07 13:43:23.043472: [debug] Run process: /usr/local/bin/docker start -a -i 1ed0063332a3035e0d70cef98f741765284eab712cbd5b14f429416d51308560
Version 2.1.3, Git revision 636e3a759d51127df2b62f90772def126cdf6d1f (7735 commits) x86_64 hpack-0.31.2
2020-03-07 08:12:59.651235: [debug] Checking for project config at: /Users/saurabhnanda/projects/haskell-aws-lambda/lambda-function/stack.yaml
2020-03-07 08:12:59.658266: [debug] Loading project config file stack.yaml
2020-03-07 08:12:59.796116: [error] Encountered error while migrating Stack database:
    SQLite3 returned ErrorIO while attempting to perform prepare "SELECT sql FROM sqlite_master WHERE type='table' AND name=?": disk I/O error
Please report this on https://github.com/commercialhaskell/stack/issues
As a workaround you may delete Stack database in /Users/saurabhnanda/.stack/stack.sqlite3 triggering its recreation.
2020-03-07 13:43:25.165101: [debug] Run process: /usr/local/bin/docker rm -f 1ed0063332a3035e0d70cef98f741765284eab712cbd5b14f429416d51308560
2020-03-07 13:43:25.279610: [debug] Process finished in 114ms: /usr/local/bin/docker rm -f 1ed0063332a3035e0d70cef98f741765284eab712cbd5b14f429416d51308560

Stack version

[LOCALHOST:~/projects/haskell-aws-lambda/lambda-function (master) saurabhnanda] $ stack --version
Version 2.1.3, Git revision 0fa51b9925decd937e4a993ad90cb686f88fa282 (7739 commits) x86_64 hpack-0.31.2

Stack version inside the docker image/container

[LOCALHOST:~/projects/haskell-aws-lambda/lambda-function (master) saurabhnanda] $ docker run -ti lambda-stack /bin/bash -l
bash-4.2# stack --version
Version 2.1.3, Git revision 636e3a759d51127df2b62f90772def126cdf6d1f (7735 commits) x86_64 hpack-0.31.2

Method of installation

mpilgrem commented 7 months ago

@saurabhnanda, I am working through open issues, including old ones. Is this still a problem with current versions? If I understand correctly, something was preventing Stack from creating a .sqlite file in the Stack root, when using Stack within a Docker container.