Skip to content

🐛 Isolate VM lifecycle state between interpreter instances #88

Description

@ccamel

Summary

SetMaxVariables and ResetEnv currently mutate global quota, variable identity, root environment, and stream IDs through engine/vm.go:399-439, engine/variable.go:10-38, engine/env.go:1-46, and engine/stream.go:19-31. Interleaving otherwise independent interpreter instances can therefore change each other's lifecycle state.

Why it matters

Interpreter isolation is required for deterministic execution. A reset in one VM can invalidate assumptions held by another VM, including retained Env bindings and stream identities.

Scope

Move variable-quota and reset ownership into a VM/session allocator while preserving globally unique term identities. Do not use a lock-only fix. This is not a quick win; design and review it separately from the seven focused issues in this set.

Acceptance criteria

  • Two interleaved VM instances retain independent variable limits.
  • Resetting one VM cannot alias bindings in an Env retained by another VM.
  • Resetting one VM cannot alias stream IDs retained by another VM.
  • A focused VM-isolation test passes with -race.

Verification

Run the focused isolation test with go test -race and exercise two interleaved VMs with distinct limits, retained environments, and retained stream IDs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    📆 To do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions