Unflushed writes to an open SD card file are lost when the VM stops
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 43/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- backend, embedded-iot
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C
- Star
- 4.6k
- Fork
- 1.4k
- Merge trung bình
- 1 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 174
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của adafruit/circuitpython
-
Move imx port to ZephyrĐang mởmimxrt10xx refactoring zephyr
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 8/100
adafruit/circuitpython#11583 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug cpython api
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 35/100
adafruit/circuitpython#11580 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Support SDIO cards as a second USB mass-storage LUNCó thể đã có người làm @ladyada đã nhận 1 ngày trước. Đang mởrp2 sdcardio storage supervisor usb
adafruit/circuitpython#11564 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
storage usb zephyr
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
adafruit/circuitpython#11531 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Move silabs to ZephyrĐang mởsilabs
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
adafruit/circuitpython#11507 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của adafruit/circuitpython
Issue tương tự
-
chore: update release scheduleĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
foomatic-rip: dstrtrim_right() underflows mid-loop on an all-whitespace stringCó thể đã có người làm @ManasBagul23 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
OpenPrinting/cups-filters#759 ·
Maintainer thường phản hồi trong vòng 11 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
EchoTools/nevr-runtime#547 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100