Unflushed writes to an open SD card file are lost when the VM stops
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 43/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 領域
- backend, embedded-iot
調査の方向性
Start by tracing stop_mp(), gc_deinit(), and gc_sweep_all() alongside reset_port(); the issue identifies these as the shutdown path and the point where SPI may already be reset. Investigate how open files are closed and how finalizer order affects the SDCard object. Done means stopping or finishing with an open file preserves writes and does not print the empty OSError; the payload names no test file.
索引モデルが issue の本文から書いたものです。
説明
Claude wrote this:
CircuitPython version and board name
Adafruit CircuitPython 11.0.0-alpha.1-69-g03db5f8ca4 on 2026-10-11; Adafruit PyPortal with samd51j20
Code
import board, sdcardio, storage, time
sdcard = sdcardio.SDCard(board.SPI(), board.SD_CS)
storage.mount(storage.VfsFat(sdcard), "/sd")
log = open("/sd/LOG.TXT", "a")
i = 0
while True:
log.write("line %d\n" % i)
i += 1
if i % 100 == 0:
log.flush()
time.sleep(0.03)
Behavior
When code.py is stopped by auto-reload, or finishes with the file still open:
OSError:with no message is printed after "Code stopped by auto-reload" or "Code done running."- Lines written since the last
flush()are lost. A newly created file that was never flushed does not appear on the card at all.
Description
The file is only closed when its finaliser runs in gc_sweep_all(), from gc_deinit() in stop_mp(). By then reset_port() has already reset the SPI bus, and the SDCard object may have been finalised first, since sweep order is arbitrary. The close() in the finaliser fails, and mp_call_function_1_protected() prints the exception.
Split out from #9138, whose hard hang no longer reproduces.
- 主要言語
- C
- スター
- 4.6k
- フォーク
- 1.4k
- 平均マージ
- 23時間 40分
- マージ済み PR(30日)
- 167
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
adafruit/circuitpython のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
adafruit/circuitpython#11606 ·
メンテナーはふだん 1 日以内に返信
-
busio zephyr
難易度 5/5 1週間以上 初心者へのやさしさ 18/100
adafruit/circuitpython#11605 ·
メンテナーはふだん 1 日以内に返信
-
busio zephyr
難易度 4/5 3〜5日 初心者へのやさしさ 28/100
adafruit/circuitpython#11604 ·
メンテナーはふだん 1 日以内に返信
-
busio zephyr
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
adafruit/circuitpython#11603 ·
メンテナーはふだん 1 日以内に返信
-
busio zephyr
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
adafruit/circuitpython#11602 ·
メンテナーはふだん 1 日以内に返信
adafruit/circuitpython の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
FriendsofECCE/ECCE#336 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
immortalwrt/immortalwrt#2501 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
taisei-project/taisei#454 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100