Title: Mypy 1.20 crashes on concurrent runs · Issue #21136 · python/mypy · GitHub
Open Graph Title: Mypy 1.20 crashes on concurrent runs · Issue #21136 · python/mypy
X Title: Mypy 1.20 crashes on concurrent runs · Issue #21136 · python/mypy
Description: Crash Report Mypy 1.20 crashes on concurrent usage because parallel process fight on accessing a sqlite database, at a first glance. Traceback version: 1.20.0 Traceback (most recent call last): File "/opt/hostedtoolcache/Python/3.11.15/x...
Open Graph Description: Crash Report Mypy 1.20 crashes on concurrent usage because parallel process fight on accessing a sqlite database, at a first glance. Traceback version: 1.20.0 Traceback (most recent call last): Fil...
X Description: Crash Report Mypy 1.20 crashes on concurrent usage because parallel process fight on accessing a sqlite database, at a first glance. Traceback version: 1.20.0 Traceback (most recent call last): Fil...
Opengraph URL: https://github.com/python/mypy/issues/21136
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Mypy 1.20 crashes on concurrent runs","articleBody":"**Crash Report**\n\nMypy 1.20 crashes on concurrent usage because parallel process fight on accessing a sqlite database, at a first glance.\n\n**Traceback**\n\n```python-traceback\nversion: 1.20.0\nTraceback (most recent call last):\n File \"/opt/hostedtoolcache/Python/3.11.15/x64/lib/python3.11/site-packages/mypy/__main__.py\", line 15, in console_entry\n main()\n File \"mypy/main.py\", line 141, in main\n File \"mypy/main.py\", line 225, in run_build\n File \"mypy/build.py\", line 388, in build\n File \"mypy/build.py\", line 485, in build_inner\n File \"mypy/build.py\", line 3664, in dispatch\n File \"mypy/build.py\", line 3938, in load_graph\n File \"mypy/build.py\", line 2431, in new_state\n File \"mypy/build.py\", line 1717, in find_cache_meta\n File \"mypy/build.py\", line 1527, in _load_ff_file\n File \"mypy/metastore.py\", line 200, in read\n File \"mypy/metastore.py\", line 187, in _query\nOperationalError: database is locked\n```\n\n**To Reproduce**\n\nA bit difficult to reproduce: it [fails regularly on github](https://github.com/dvarrazzo/psycopg/actions/workflows/lint.yml).\n\nThe cause of the failure is pre-commit running 4 concurrent runs of mypy each with about 60 input files. Adding a wrapper script in [this run](https://github.com/dvarrazzo/psycopg/actions/runs/23847506664) you can see the timings of the run and the list of files passed. Trying the same on my local machine doesn't reproduce because pre-commit decides to pass 20 files per run and the issue is not triggered. I don't see an easy way to configure the batch size used by pre-commit, but it wouldn't be a reliable test anyway.\n\nLooking at the timing of the concurrent processes in the failed run above:\n\n```\npid: 3032 t0: 1775044872.4642754 started\npid: 3030 t0: 1775044872.4644167 started\npid: 3033 t0: 1775044872.4644256 started\npid: 3034 t0: 1775044872.4649644 started\npid: 3034 tf: 1775044879.1738014 success\npid: 3030 tf: 1775044882.4480267 success\npid: 3032 tf: 1775044884.7451327 failed \npid: 3033 tf: 1775044885.9920673 success\n```\n\n**Your Environment**\n\n- Mypy version used: 1.20\n- Mypy command-line flags: `mypy --pretty --follow-imports=silent --show-traceback file1 file2 ...` for long lists of files and with concurrent runs.\n- Mypy configuration options from `mypy.ini` (and other config files): [here](https://github.com/psycopg/psycopg/blob/eb87f0eb58ee05b7202b7d8835b925b084d32b5c/pyproject.toml)\n- Python version used: 3.11.15\n- Operating system and version: Ubuntu 24.04\n","author":{"url":"https://github.com/dvarrazzo","@type":"Person","name":"dvarrazzo"},"datePublished":"2026-04-01T13:45:52Z","url":"https://github.com/python/mypy/issues/21136"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a6427956-4b7c-a7e0-095d-4f90a0c51a6f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E6C2:1A1C04:22CF6AB:2F84875:6B002C77 |
| html-safe-nonce | dae4911f38f0ebf050b08baf5a47db4b443d85e33f3ee0eea41d6770630d976d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNkMyOjFBMUMwNDoyMkNGNkFCOjJGODQ4NzU6NkIwMDJDNzciLCJ2aXNpdG9yX2lkIjoiNjA1NDgxNzg4NTE5OTU0MzQxNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 440bacb22b544223e5a88d85b740de2524e9cced7458a1d17696c8090d0af901 |
| hovercard-subject-tag | issue:4187077586 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/mypy/21136/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e7239de945f153b96df99636df7dace743d301496b5028a83f45af64606b439b/python/mypy/issues/21136 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e7239de945f153b96df99636df7dace743d301496b5028a83f45af64606b439b/python/mypy/issues/21136 |
| og:image:alt | Crash Report Mypy 1.20 crashes on concurrent usage because parallel process fight on accessing a sqlite database, at a first glance. Traceback version: 1.20.0 Traceback (most recent call last): Fil... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dvarrazzo |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width