Skip to content

micropython-wasm: guest exited with code 1 and wasm trap: all fuel consumed by WebAssembly #11

Description

@clach04

I may be misusing and abusing micropython-wasm...

I'm too lazy to attempt to build/debug micropython for Windows so was super excited by this project. My quick and dirty concat library and mini-test script works fine in the browser you have hosted on Github. I had time to try the command line today.

I have zero experience with wasm...

There may be two separate issues.

  1. Running test script that imports a module (on disk) from the command line without any sort of sandbox setup script that does NOT set up or define readonly_dir) fails with:

     micropython-wasm: guest exited with code 1
    

    This happens whether --memory or --fuel is specified. Simple print() script works fine.

  2. Running a concatenated script fails with:

     micropython-wasm: guest trapped: error while executing at wasm backtrace:
         0:   0x7d2f - <unknown>!<wasm function 171>
         1:  0x38c2f - <unknown>!<wasm function 1268>
         2:  0x373ef - <unknown>!<wasm function 1264>
         3:  0x363aa - <unknown>!<wasm function 1263>
         4:  0x3cb5a - <unknown>!<wasm function 1320>
         5:   0x10c9 - <unknown>!<wasm function 27>
    
     Caused by:
         wasm trap: all fuel consumed by WebAssembly
    

    I cargo-cult copy/paste/modified my way out of this via:

     micropython-wasm --memory 33554432 --fuel 200000000 tztest.py
    

    By increasing the sample fuel listed in the demo doc section https://github.com/simonw/micropython-wasm#quick-start

Questions:

  1. Is the code 1 exit a bug or expected behavior?
  2. Does it make sense for the error message about fuel consumption to be extended to suggest the fuel parameters (either command line or run parameter)? Or is that outside of this project?

I'm workaround number 1 with the concat scripts and execute approach for now, with more fuel arguments, as this is my code and I don't care about the sandbox. This is my lazy solution to testing Micropython code under Windows, where CPython is not a suitable environment (it's not compatible enough).

Thanks for making this available and the regularly updated blog. I'm really enjoying the recent AI observations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions