You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There seems to be an issue with the async mechanism used in the Javascript/Typescript API (ref: https://www.npmjs.com/package/z3-solver). Specifically, the async process spawned never terminates (and the undocumented workaround in the tests also seems to be failing).
Minimal Working Example
A minimal example is the following test in Jest, which will produce the warning seen below (or will hang forever if the code is extracted and run outside a test environment):
import{init}from'z3-solver';test('basic example',async()=>{const{ Context }=awaitinit();constZ3=Context('main');constx=Z3.Int.const('x');consty=Z3.Int.const('y');constsolver=newZ3.Solver();solver.add(x.add(2).le(y.sub(10)));// x + 2 <= y - 10letsat=awaitsolver.check();expect(sat).toBe("sat");constmodel=solver.model();expect(`${model.get(x)}`).toBe("0");expect(`${model.get(y)}`).toBe("12");});
Result:
A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. ...
For context, if you runt this outside a test environment, the spawned thread never yields/terminates and must be manually killed.
Failing Workaround
The test file here appears to show an undocumented workaround, which is to import em alongside Context and run em.PThread.terminateAllThreads();.
However, I tried this, and it produces the same result.
Code:
import{init}from'z3-solver';test('basic example',async()=>{const{ Context, em }=awaitinit();constZ3=Context('main');constx=Z3.Int.const('x');consty=Z3.Int.const('y');constsolver=newZ3.Solver();solver.add(x.add(2).le(y.sub(10)));// x + 2 <= y - 10letsat=awaitsolver.check();expect(sat).toBe("sat");constmodel=solver.model();expect(`${model.get(x)}`).toBe("0");expect(`${model.get(y)}`).toBe("12");em.PThread.terminateAllThreads();});
Result:
A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown.
The text was updated successfully, but these errors were encountered:
There seems to be an issue with the async mechanism used in the Javascript/Typescript API (ref: https://www.npmjs.com/package/z3-solver). Specifically, the async process spawned never terminates (and the undocumented workaround in the
tests
also seems to be failing).Minimal Working Example
A minimal example is the following test in Jest, which will produce the warning seen below (or will hang forever if the code is extracted and run outside a test environment):
Result:
For context, if you runt this outside a test environment, the spawned thread never yields/terminates and must be manually killed.
Failing Workaround
The test file here appears to show an undocumented workaround, which is to import
em
alongsideContext
and runem.PThread.terminateAllThreads();
.However, I tried this, and it produces the same result.
Code:
Result:
The text was updated successfully, but these errors were encountered: