Bug: Thread cleanup exception during interpreter shutdown when using VS Code debugger
まだ誰も着手していません。
評価
調査の方向性
まず、提供されたスクリプトを VS Code デバッガーで再現し、通常の python script.py の実行結果と比較します。デバッガーが管理するスレッドと、_DeleteDummyThreadOnDel.__del__ 周辺のインタープリター終了時のクリーンアップを調査します。デバッガーでの実行が報告された TypeError なしで終了すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
📌 Environment
- Python Version: 3.13.5
- OS: Windows 11
- Debugger: VS Code (debugpy)
📝 Description
When running code under the VS Code debugger, an exception is raised during interpreter shutdown:
Exception ignored in: <function _DeleteDummyThreadOnDel.__del__>
Traceback (most recent call last):
File ".../threading.py", line 1385, in __del__
TypeError: 'NoneType' object does not support the context manager protocol
🔍 Key Observation
- ❌ Does NOT occur when running normally (
python script.py) - ✅ Only occurs when running via VS Code debugger
🧪 Steps to Reproduce
from strands import Agent, tool
from strands_tools import http_request
import boto3
from strands.models import BedrockModel
session = boto3.Session(region_name="us-east-1")
model = BedrockModel(
model_id="your-model-id",
boto_session=session
)
@tool
def dummy_tool(text: str) -> str:
return text
agent = Agent(
system_prompt="Test agent",
tools=[http_request, dummy_tool],
model=model
)
agent("Test request")
print("DONE EXECUTION")
📤 Observed Output (Debugger Only)
DONE EXECUTION
Exception ignored in: <function _DeleteDummyThreadOnDel.__del__>
Traceback (most recent call last):
File ".../threading.py", line ...
TypeError: 'NoneType' object does not support the context manager protocol
✅ Expected Behavior
No exception during interpreter shutdown in debugger mode.
❌ Actual Behavior
Thread cleanup triggers a TypeError during interpreter shutdown when running under debugger.
📎 Notes
- Likely related to debugger-managed threads and interpreter shutdown order
- Possibly occurs when threads outlive global state during teardown
- Does not impact runtime correctness
🛠️ Workarounds
- Running script outside debugger avoids issue
- Adding delays (
time.sleep) reduces occurrence but does not fully eliminate
📌 Summary
This appears to be a debugger-related threading cleanup issue during interpreter shutdown in Python 3.13.
- 主要言語
- Python
- スター
- 2.5k
- フォーク
- 202
- 平均マージ
- 5日 1時間
- マージ済み PR(30日)
- 1
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/debugpy のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
microsoft/debugpy の issue をすべて見る
似ている issue
-
bug confirmed issue
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
open-webui/open-webui#30750 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 90/100