Skip to content

Drop _VeraExit(130) workaround in host_sleep once wasmtime-py with #337 lands on PyPI #599

@aallan

Description

@aallan

Summary

Bookmark for tracking the removal of Vera's host_sleep _VeraExit(130) workaround once a wasmtime-py release containing bytecodealliance/wasmtime-py#337 lands on PyPI.

Context

#595 tracked the macOS malloc abort during wasmtime cleanup after Ctrl+C arrives in a host import (originally observed with IO.sleep). Diagnosis: the wasmtime-py trampoline at wasmtime/_func.py:212 caught Exception rather than BaseException, so BaseException subclasses (KeyboardInterrupt, SystemExit, custom BaseException subclasses) escaped the handler and caused a SIGABRT inside Rust's array_call_trampoline with an undefined ABI return value. Filed upstream as bytecodealliance/wasmtime-py#336; fixed by bytecodealliance/wasmtime-py#337 (one-line change to except BaseException), merged 2026-05-07.

In the meantime, Vera v0.0.137 added a defensive workaround in vera/codegen/api.py::host_sleep:

def host_sleep(_caller: wasmtime.Caller, ms: int) -> None:
    if ms > 0:
        try:
            time.sleep(ms / 1000.0)
        except KeyboardInterrupt:
            # ... long comment about the wasmtime-py trampoline bug ...
            raise _VeraExit(130) from None

This converts KeyboardInterrupt to a _VeraExit (an Exception subclass, which the buggy trampoline does catch) and the execute() chain unwraps _VeraExit into a clean exit code 130. User-visible UX is correct (clean SIGINT exit), but the workaround duplicates effort the upstream fix already does properly.

What this bookmark tracks

When the next wasmtime-py release lands on PyPI containing commit 5c84f841:

  1. Bump pyproject.toml to require that wasmtime-py minimum (current pin: 43.0.0). Run the full test matrix before merging — this is the broader-surface change.
  2. Then, in a separate follow-up PR, remove the _VeraExit(130) guard in vera/codegen/api.py::host_sleep and let KeyboardInterrupt propagate naturally. Keeping the dependency bump and the workaround removal in separate PRs means each can be reverted independently if anything goes wrong.
  3. Update the test at tests/test_runtime_traps.py::TestHostSleepKeyboardInterrupt — the structural assertion for the guard becomes a structural assertion that the guard is absent (or just delete it; the end-to-end test stands on its own).
  4. Close #595 and remove the runtime-workaround entry from KNOWN_ISSUES.md.
  5. Close this bookmark issue.

Why a bookmark and not a normal open issue

There's nothing actionable in the Vera codebase today — the work is gated entirely on an upstream release timeline we don't control. The bookmark prevents the workaround from rotting silently in host_sleep once the underlying bug is gone.

Watching

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bookmarkSaving a link to another project

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions