Skip to content

WASM bindings are broken #7399

@NikolajBjorner

Description

@NikolajBjorner

Z3 now uses c++20. #7379
However, there is something amiss for more than a month now. The continuous build/test of WASM bindings is broken.
@pelikhan and I can confirm it remains broken when setting it up over codespaces (following the steps in the README.md and then running npm test).
Some observations:

  • emsdk uses node 18, the current default is 20. Switching to node 18 mode doesn't seem to matter.
  • it runs out of memory.
  • Commenting out the unit test (number 17) does not change the memory issue, it just runs out of memory later.
  • Adding an early return before number 17 causes an exception.
  • Adding console.log to calls like
    constructor(ptr: Z3_solver | string = Z3.mk_solver(contextPtr)) {
        this.ctx = ctx;
        let myPtr: Z3_solver;
        if (typeof ptr === 'string') {
          myPtr = check(Z3.mk_solver_for_logic(contextPtr, _toSymbol(ptr)));
        } else {
          myPtr = ptr;
        }
        this.ptr = myPtr;
        console.log("create solver");
        Z3.solver_inc_ref(contextPtr, myPtr);
        cleanup.register(this, () => { console.log("dec-ref-solver"); Z3.solver_dec_ref(contextPtr, myPtr);});
      }

suggests that the cleanup actions are never run.
I can see that cleanup is an instance of FinalizationRegistry, that is connected to GC.

  • Should the gc be forced? Global.gc, std.global.gc, std.gc?

@bakkot

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