python / python/mypy

sqlite3.OperationalError: disk I/O error

未关闭
#22,010 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

crash
主要语言
Python
星标
20.6k
派生
3.3k
PR 合并指标
PR 指标待抓取

描述

Crash Report

$ mypy . --show-traceback
error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 2.3.1
Traceback (most recent call last):
  File "/tmp/py/lib/python3.14/site-packages/mypy/__main__.py", line 16, in console_entry
    main()
    ~~~~^^
  File "mypy/main.py", line 154, in main
  File "mypy/main.py", line 244, in run_build
    res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
  File "mypy/build.py", line 385, in build
  File "mypy/build.py", line 1908, in create_metastore
    mds: MetadataStore = SqliteMetadataStore(
  File "mypy/metastore.py", line 200, in __init__
  File "mypy/metastore.py", line 172, in connect_db
    db.execute("PRAGMA synchronous=OFF")
sqlite3.OperationalError: disk I/O error

note: use --pdb to drop into pdb

To Reproduce

Source files are in a network mount:

$ mount | grep src
src on /home/hugo/src type 9p (rw,relatime,access=client,trans=virtio)

Sources are readable, execute fine, can be checked with ruff, etc.

You can quickly run a VM to reproduce this via:

qemu-system-x86_64 \
	--enable-kvm \
	-nic user \
	-nographic \
	-m 4G \
	-smp cores=2 \
        -drive file=alpine-virt-3.24.1-x86_64.iso,format=raw \                                                                                                                                                                                 
	-virtfs local,path=$HOME/src/,mount_tag=src,security_model=mapped-xattr

Then install mypy, mount the shared filesystem, and run it on any code in that fs.

Your Environment

  • Mypy version used: mypy 2.3.1 (compiled: yes)
  • Mypy command-line flags: (none/any)
  • Mypy configuration options from mypy.ini (and other config files): irrelevant; always happens
  • Python version used: Python 3.14.7
  • Operating system and version: Alpine Linux Edge

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 mypy/metastore.py 开始,重点查看 connect_db 和 create_metastore,traceback 会在那里到达 PRAGMA synchronous=OFF。使用提供的 Alpine VM 和通过 9p 挂载的源代码树重现问题,然后检查元数据数据库在该挂载上的行为。在报告的环境中确认 mypy 不再因这个内部 sqlite3.OperationalError 而终止,才算完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
python, sqlite
领域
databases, tooling
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
需要澄清
新手友好度
52/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。