Unflushed writes to an open SD card file are lost when the VM stops
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 43/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Área
- backend, embedded-iot
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- C
- Estrellas
- 4.6k
- Forks
- 1.4k
- Merge medio
- 1 d 2 h
- PR fusionados (30 d)
- 174
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de adafruit/circuitpython
-
Move imx port to ZephyrAbiertomimxrt10xx refactoring zephyr
Dificultad 5/5 Más de una semana Aptitud para principiantes 8/100
adafruit/circuitpython#11583 ·
Los mantenedores suelen responder en 1 día
-
bug cpython api
Dificultad 3/5 Medio día Aptitud para principiantes 35/100
adafruit/circuitpython#11580 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Support SDIO cards as a second USB mass-storage LUNPosiblemente ocupada @ladyada la tomó hace 1 día. Abiertorp2 sdcardio storage supervisor usb
adafruit/circuitpython#11564 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
storage usb zephyr
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
adafruit/circuitpython#11531 ·
Los mantenedores suelen responder en 1 día
-
Move silabs to ZephyrAbiertosilabs
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
adafruit/circuitpython#11507 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de adafruit/circuitpython
Issues similares
-
bug good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
enhancement
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
FujiNetWIFI/fujinet-lib#122 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 12 días
-
bug format I/O medium priority rt_lib
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 84/100