`put_async(Path)` opens files synchronously while holding the GIL
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 領域
- backend, performance
調査の方向性
Start by tracing put_async() argument extraction for native Path inputs and the Rust async upload path; the issue names no source files or tests. Check how file opening and seek based size detection interact with cancellation and multipart selection. Done means slow opens do not block the event loop or hold the GIL, with the existing reader and upload behavior preserved.
索引モデルが issue の本文から書いたものです。
説明
Passing a pathlib.Path to obstore.put_async() opens the file during PyO3 argument extraction, before returning the awaitable. This happens synchronously while holding the Python GIL.
If opening the file stalls, it blocks the calling event loop. Moving the call to a Python worker thread does not fully address this: the file open still holds the GIL, preventing other Python threads from progressing.
Reproduction
On Unix, a named pipe provides a deterministic way to simulate a slow open. An external process supplies data after one second:
import asyncio
import os
import subprocess
import sys
import tempfile
from pathlib import Path
import obstore
from obstore.store import MemoryStore
async def main():
with tempfile.TemporaryDirectory() as directory:
source = Path(directory) / "source"
os.mkfifo(source)
writer = subprocess.Popen([
sys.executable,
"-c",
"""
import sys
import time
time.sleep(1)
with open(sys.argv[1], "wb") as output:
output.write(b"hello")
""",
str(source),
])
async def heartbeat():
while True:
print("tick", flush=True)
await asyncio.sleep(0.1)
heartbeat_task = asyncio.create_task(heartbeat())
try:
await asyncio.sleep(0.1)
await obstore.put_async(
MemoryStore(),
"destination",
source,
use_multipart=False,
)
finally:
heartbeat_task.cancel()
await asyncio.gather(heartbeat_task, return_exceptions=True)
await asyncio.to_thread(writer.wait)
asyncio.run(main())
Observed: heartbeats stop while the file is opening.
Expected: local file preparation should not block the Python event loop or hold the GIL during blocking filesystem operations.
Possible fix
Defer opening native Path inputs until the Rust async operation runs, using tokio::task::spawn_blocking for opening and any seek-based size detection. Preserve the existing native reader and upload pipeline afterward.
A local prototype passes regression tests for event-loop responsiveness, cancellation during opening, and multipart selection. One observable behavior change is that file-opening errors would surface when awaiting the operation, rather than during the initial call.
If this fix is sound, I can open a PR with my local patch.
Reproduced with Obstore 0.11.1, CPython 3.14.7, macOS arm64.
- 主要言語
- Python
- スター
- 830
- フォーク
- 45
- 平均マージ
- 7時間 53分
- マージ済み PR(30日)
- 13
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
developmentseed/obstore のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 75/100
developmentseed/obstore#779 · コメント 5 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 67/100
developmentseed/obstore#778 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 50/100
developmentseed/obstore#772 ·
メンテナーはふだん 1 日以内に返信
-
LocalStore fsspec adding extra path stuff in Windows対応中かも @dajiaohuang が 15 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
developmentseed/obstore#763 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
developmentseed/obstore#754 · コメント 6 件 ·
メンテナーはふだん 1 日以内に返信
developmentseed/obstore の issue をすべて見る
似ている issue
-
[Bug]: Responses API 500s on assistant message with empty content list対応中かも @shadowmodder が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
vllm-project/vllm#64940 ·
メンテナーはふだん 1 日以内に返信
-
limits
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
Status: Triage Type: Quest
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
GTNewHorizons/GT-New-Horizons-Modpack#27490 ·
メンテナーはふだん 1 日以内に返信
-
LLM.save() discards the model's active prompt style対応中かも @remote-controlled-man が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Lightning-AI/litgpt#2378 ·
メンテナーはふだん 23 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信