8000 "FATAL: uncaught exception" on KeyboardInterrupt during large printout at normal REPL · Issue #4921 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content
"FATAL: uncaught exception" on KeyboardInterrupt during large printout at normal REPL #4921
Closed
@mikewadsten

Description

@mikewadsten

This is a bug that I originally found in our own commercial product running a fork of MicroPython, but I have since reproduced on the mainline STM32 port as well.

At the friendly REPL, if you enter an expression such as "a" * 10000 and then very quickly hit Ctrl-C, MicroPython will crash with "FATAL: uncaught exception <pointer>", where <pointer> corresponds to mp_state_ctx.vm.mp_kbd_exception.

I am able to reproduce this with both the v1.10 and v1.11 branches, including the current master (154062d). For v1.11 reproduction, I am using an STM32F415ZG based dev board internal to our company (compiled on a branch whose only changes are board-specific, no core tweaks). My other reproduction is on our Silicon Labs EFM32 based product. The fact that I can reproduce on STM32 tells me the bug is not specific to our product.

I am not able to reproduce on v1.9, at least where I've tested (including a microbit).

From my own analysis of the "uncaught exception" message, I believe the cause of the crash is that the REPL runs parse_compile_execute to execute the given expression, which sees the KeyboardInterrupt being raised, restores context, and re-raises -- but there's no surrounding nlr_push at the REPL, so nlr_jump_fail ends up being called.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0