# Python 3.6 - sqlite3.OperationalError: disk I/O error

**URL:** <https://travis-ci.community/t/python-3-6-sqlite3-operationalerror-disk-i-o-error/6737>\
**Category:** Python\
**Tags:** python\
**Created:** [January 5, 2020, 5:50pm UTC](https://travis-ci.community/t/python-3-6-sqlite3-operationalerror-disk-i-o-error/6737 "2020-01-05T17:50:32Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![caronc](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/caronc/32/1124_2.png) [@caronc](https://travis-ci.community/u/caronc)\
**Post date:** [January 5, 2020, 5:50pm UTC](https://travis-ci.community/t/python-3-6-sqlite3-operationalerror-disk-i-o-error/6737/1 "2020-01-05T17:50:32Z")

</div>

Today just the my Python 3.6 builds are failing ([source](https://travis-ci.org/caronc/apprise-api/jobs/632992062?utm_medium=notification&utm_source=github_status)). All other Python builds work fine ([source](https://travis-ci.org/caronc/apprise-api?utm_medium=notification&utm_source=github_status)).

Any advise would be fantastic! 🙂

**Edit** : Merged with master and build is [still failing](https://travis-ci.org/caronc/apprise-api) 🙁  
[![Build Status](https://travis-ci.org/caronc/apprise-api.svg?branch=master)](https://travis-ci.org/caronc/apprise-api)

It appears to be an issue on the Travis CI end (specifically the _stable.xenial_ Python v3.6.7 AMD64 test container) - [master build fail source](https://travis-ci.org/caronc/apprise-api/jobs/633075837).

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [January 6, 2020, 4:53pm UTC](https://travis-ci.community/t/python-3-6-sqlite3-operationalerror-disk-i-o-error/6737/2 "2020-01-06T16:53:01Z")

</div>

Some builds are successful (e.g., [https://travis-ci.org/caronc/apprise-api/jobs/632762260](https://travis-ci.org/caronc/apprise-api/jobs/632762260)) so I tend to think this is some sort of timing issue. If you restart them, do they all fail? I’m happy to enable debug feature on for this repository, so you can troubleshoot further.

---

<div class="post-metadata">

**Author:** ![caronc](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/caronc/32/1124_2.png) [@caronc](https://travis-ci.community/u/caronc)\
**Post date:** [January 6, 2020, 6:21pm UTC](https://travis-ci.community/t/python-3-6-sqlite3-operationalerror-disk-i-o-error/6737/3 "2020-01-06T18:21:38Z")

</div>

@BanzaiMan, thank you for getting back to me! 🙂

I’d definitely appreciate if you could enable debugging if at all possible. If it’s a timing issue, do i just need to add a `sleep 5s` at the end of the `.travis.yml` and/or `tox.ini` file then for the Python 3.6 calls?

Seems weird how this worked perfectly before (2 weeks ago). Also, Python 3.5, 3.7, and 3.8 build without any problems at all. [Here](https://travis-ci.org/caronc/apprise-api/jobs/633075837) is the master one i just tried to restart (and failed again). Maybe stick debugging here?

Thanks again for your speeding response and help!

Chris

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [January 6, 2020, 6:45pm UTC](https://travis-ci.community/t/python-3-6-sqlite3-operationalerror-disk-i-o-error/6737/4 "2020-01-06T18:45:59Z")

</div>

The debug feature has been enabled for this repo.

Nothing has changed for this (xenial, Python 3.6) has changed in recent weeks. There might have been some underlying changes to your dependencies, so I’d suggest examining those as well. (If, for example, if you restart a previously successful build and it now fails, then the changes in your dependencies are very likely to blame.)

---

<div class="post-metadata">

**Author:** ![caronc](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/caronc/32/1124_2.png) [@caronc](https://travis-ci.community/u/caronc)\
**Post date:** [January 6, 2020, 7:27pm UTC](https://travis-ci.community/t/python-3-6-sqlite3-operationalerror-disk-i-o-error/6737/5 "2020-01-06T19:27:20Z")

</div>

I took your advice and went back to an old build that went fine ([link](https://travis-ci.org/caronc/apprise-api/builds/632753607))

 ![Screenshot from 2020-01-06 14-03-19](https://us1.discourse-cdn.com/flex015/uploads/travis_ci/original/2X/d/d06c118b7fd3c39e65e281025b202d92479f4f15.png)

When I rebuilt just the Python 3.6 (in question) it failed (for same reason):

 ![Screenshot from 2020-01-06 14-25-08](https://us1.discourse-cdn.com/flex015/uploads/travis_ci/original/2X/e/eea914d4a8d3f9c5217c0c01719d8d2096955851.png)

Thoughts?

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [January 6, 2020, 7:38pm UTC](https://travis-ci.community/t/python-3-6-sqlite3-operationalerror-disk-i-o-error/6737/6 "2020-01-06T19:38:22Z")

</div>

Please check your dependencies. There should be some changes that triggered this failure.

---

<div class="post-metadata">

**Author:** ![caronc](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/caronc/32/1124_2.png) [@caronc](https://travis-ci.community/u/caronc)\
**Post date:** [January 6, 2020, 8:00pm UTC](https://travis-ci.community/t/python-3-6-sqlite3-operationalerror-disk-i-o-error/6737/7 "2020-01-06T20:00:36Z")

</div>

The only change evident is `coverage==5.0.1`; the builds do not explicitly set a specific version ([screenshot taken from here](https://travis-ci.org/caronc/apprise-api/jobs/632755499)):

 ![Apprise.Working.Build](https://us1.discourse-cdn.com/flex015/uploads/travis_ci/original/2X/2/2d458c39a112cc38c9a73668bf5cd5120a555ae0.png)

Otherwise everything is identical; the failing build shows `coverage==5.0.2` ([screenshot taken from here](https://travis-ci.org/caronc/apprise-api/jobs/633080536?))

 ![Apprise.Working.Not-Working-Build](https://us1.discourse-cdn.com/flex015/uploads/travis_ci/original/2X/c/c318e807675f7f3f9b9f43be9ab864f6f003f74c.png)

When i get home, I’ll explicitly create a branch forcing `coverage` to version `5.0.1` and see what happens. thanks again for all your help so far! I really hope you’re right and the problem is that easy!

**Edit** : Opened up this ticket here with [coverage](https://github.com/nedbat/coveragepy/issues/915)

---

<div class="post-metadata">

**Author:** ![caronc](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/caronc/32/1124_2.png) [@caronc](https://travis-ci.community/u/caronc)\
**Post date:** [January 8, 2020, 5:08pm UTC](https://travis-ci.community/t/python-3-6-sqlite3-operationalerror-disk-i-o-error/6737/8 "2020-01-08T17:08:35Z")

</div>

@BanzaiMan: Just out of curiosity, to help with the [open github ticket](https://github.com/nedbat/coveragepy/issues/915) with coverage, are the containers you guys host internally available to us? The developer isn’t able to reproduce the issue. Alternatively, can you stick an _strace_ on the call?

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [January 8, 2020, 8:47pm UTC](https://travis-ci.community/t/python-3-6-sqlite3-operationalerror-disk-i-o-error/6737/9 "2020-01-08T20:47:15Z")

</div>

You can use [https://hub.docker.com/repository/docker/travisci/ci-sardonyx](https://hub.docker.com/repository/docker/travisci/ci-sardonyx). I’ve reproduced the issue with travisci/ci-sardonyx:packer-1542104228-d128723 in particular. (This image may not be exactly the same as one that is in use, but should be similar enough to troubleshoot.)

```auto
cid=$(docker run -dti --privileged=true --entrypoint=/sbin/init -v /sys/fs/cgroup:/sys/fs/cgroup:ro travisci/ci-sardonyx:packer-1542104228-d128723)
docker exec -it $cid /bin/bash

```

You’d be `root`. Switch to `travis` (`su - travis`) and run the essential commands:

```auto
git clone --depth=50 --branch=python38-ci-testing https://github.com/caronc/apprise-api.git caronc/apprise-api
cd caronc/apprise-api/
export TOXENV=py36
source ~/virtualenv/python3.6/bin/activate
python --version
pip --version
pip install codecov
pip install -r dev-requirements.txt
pip install -r requirements.txt
tox

```

---

<div class="post-metadata">

**Author:** ![caronc](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/caronc/32/1124_2.png) [@caronc](https://travis-ci.community/u/caronc)\
**Post date:** [January 11, 2020, 10:51pm UTC](https://travis-ci.community/t/python-3-6-sqlite3-operationalerror-disk-i-o-error/6737/10 "2020-01-11T22:51:29Z")

</div>

The developer ended up [determining that it’s not the specific version of his software that is doing it](https://github.com/nedbat/coveragepy/issues/915#issuecomment-573339967). It’s tied to `pytest-cov` instead which is the same version in all of my past passing builds and failing new ones. Forcing `coverage==5.0.1` [proved to be just a red herring](https://travis-ci.org/caronc/apprise-api/jobs/635803571) after-all.

~~He also made an observation that it is tied to an alpha version of SQLite (5.0a2) that is installed. This kind of hints that the container has changed from the past (and to now). Is there anyway we can roll back from the alpha build and use the previous stable version instead?~~

Perhaps you have some suggestions? 🙂

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [January 12, 2020, 3:10am UTC](https://travis-ci.community/t/python-3-6-sqlite3-operationalerror-disk-i-o-error/6737/11 "2020-01-12T03:10:10Z")

</div>

Without seeing the underlying error, it’s impossible to say what exactly is wrong.

If you build Python from source with [https://github.com/python/cpython/pull/1108](https://github.com/python/cpython/pull/1108) applied, you should be able to see it.

Alternatively, `strace` should show the OS-level error (but you’ll need to filter it out from tons of system calls and due to the trace size, will probably have to upload it somewhere for examination).

SO questions with this error suggest that this can happen if you call `commit()` in a tight loop (should rather call it outside the loop) or if something else is using the `.db-journal` file at the same time (unlikely in Travis, but [auditing](https://www.cyberciti.biz/tips/linux-audit-files-to-see-who-made-changes-to-a-file.html) should show this).

---

<div class="post-metadata">

**Author:** ![palakjadwani](https://avatars.discourse-cdn.com/v4/letter/p/f1d935/32.png) [@palakjadwani](https://travis-ci.community/u/palakjadwani)\
**Post date:** [May 5, 2020, 10:56pm UTC](https://travis-ci.community/t/python-3-6-sqlite3-operationalerror-disk-i-o-error/6737/12 "2020-05-05T22:56:28Z")

</div>

I had been searching for this error from almost an hour. thanks for the comment. tried it 2-3 times. it worked fine 3rd time. THANKYOU
