Skip to content

"Aborted(RuntimeError: unreachable executed)" - possible memory leak? #105

@microbit-matt-hillsdon

Description

@microbit-matt-hillsdon

From microbit-foundation/python-editor-v3#1127

This reproduction counts to 1997 and then crashes with

Uncaught RuntimeError: Aborted(RuntimeError: unreachable executed). "unreachable" may be due to ASYNCIFY_STACK_SIZE not being large enough (try increasing it)
    abort https://python-simulator.usermbit.org/v/0.1/build/firmware.js:1013
    runAndAbortIfError https://python-simulator.usermbit.org/v/0.1/build/firmware.js:1864
    maybeStopUnwind https://python-simulator.usermbit.org/v/0.1/build/firmware.js:1971
    x https://python-simulator.usermbit.org/v/0.1/build/firmware.js:1941
    doRewind https://python-simulator.usermbit.org/v/0.1/build/firmware.js:2015
    handleSleep https://python-simulator.usermbit.org/v/0.1/build/firmware.js:2048
    callUserCallback https://python-simulator.usermbit.org/v/0.1/build/firmware.js:1431
    createModule https://python-simulator.usermbit.org/v/0.1/build/firmware.js:1451

You can see the crash in the editor or the sim demo page.

If you you allocate more/bigger lists in c() then it fails after fewer iterations.

It also fails if you replace the list with bytearray().

It works if you reduce the level of nesting (e.g. call c() directly in a).

def a():
    i = 0
    while True:
        print(i)
        i += 1
        b()

def b():
    c()

def c():
    []

a()

Not sure whether it's really an asyncify-related problem or a leak manifesting like that.

I've not yet tried the suggestion in the error of increasing the stack size.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions