python / python/mypy

dmypy in a metadata reload loop with `--use-fine-grained-cache`

オープン
#17,831 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug topic-daemon
主要言語
Python
スター
20.6k
フォーク
3.3k
PR マージ指標
PR 指標を取得中

説明

Bug Report

I'm investigating remote caching, I find that dmypy is spinning for a very long time when using --use-fine-grained-cache. I've tried dmypy check <file> and it takes 10 minutes before I give up. If I used no caching at all, it would take 1.5 minutes, and give me expected answers.

To Reproduce

  1. produce a cache with mypy --cache-fine-grained --sqlite-cache --no-incremental --cache-dir=...
  2. % dmypy start --log-file debug.log --timeout=3600 -- --use-fine-grained-cache --cache-dir=<cache> --sqlite-cache --verbose
  3. time dmypy check tools/my_tool.py 2>&1 | ts > log.txt

Expected Behavior

fast checks

Actual Behavior

Seems to spin at 100% cpu for a long time. in the log, I see just a bunch of

...
2254727 Sep 25 17:35:45 LOG:  Metadata not found for <module>
2254728 Sep 25 17:35:45 LOG:  Using cached AST for <module path> (<module>)
...

for every file in my venv & project. indeed, I see the same modules on repeat:

% grep 'Metadata not found for numpy.fft.helper' log.txt | wc -l 
284

which makes me think this is stuck in a loop.

Your Environment

  • Mypy version used: mypy 1.10.1 (compiled: yes)
  • Mypy command-line flags: (see above)
  • Mypy configuration options from mypy.ini (and other config files):
[mypy]
platform = linux
plugins = private_internal_plugin.py,trio_typing.plugin
skip_cache_mtime_checks = true
allow_any_generics = false
allow_incomplete_defs = false
allow_subclassing_any = false
allow_untyped_decorators = false
allow_untyped_defs = false
warn_redundant_casts = true
warn_unused_ignores = true
warn_return_any = true
implicit_reexport = true
show_error_codes = true
implicit_optional = true
explicit_package_bases = true
local_partial_types = true
exclude = (?x)(<some regex>)
disable_error_code = import-untyped
enable_error_code = ignore-without-code, unused-awaitable, truthy-bool, possibly-undefined
  • Python version used: Python 3.11.10

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

記載されている mypy のキャッシュ生成コマンドと dmypy start/check コマンドで再現し、debug.log と log.txt を取得する。まず、繰り返される「Metadata not found」と「Using cached AST」のエントリを追跡する。numpy.fft.helper の繰り返しも含める。dmypy check がメタデータの再読み込みループなしで完了し、キャッシュなしの実行より大幅に高速になれば完了とする。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python, sqlite
領域
cli, devtools, performance
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。