Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smt2lib log does not lead to a valid log #5805

Closed
SolalPirelli opened this issue Jan 31, 2022 · 3 comments
Closed

smt2lib log does not lead to a valid log #5805

SolalPirelli opened this issue Jan 31, 2022 · 3 comments

Comments

@SolalPirelli
Copy link

Separate issue originally mentioned in #5655.

I have a Python program using Z3 (via angr) without parallelism.

Here's the log from z3.set_param('solver.smtlib2_log', '/tmp/z3log'): https://transfer.sh/get/OpJJk3/z3log

It's broken in two ways: some statements start before others have ended, such as line 1364: (and (= allocated_fracs_3_v_294_8 al(check-sat, while some lines start with a bunch of NUL chars, e.g. lines 2045 and 2086.

I originally thought I might be accidentally using Z3 in a multithreaded way, but given that I only get a single file even after ca2c2bb (using z3 4.8.14), perhaps Z3 itself is doing something weird with the output? Either multi-threading or seeking to the wrong offset to write would be my guesses.

NikolajBjorner added a commit that referenced this issue Jan 31, 2022
@NikolajBjorner
Copy link
Contributor

Could you be reusing the log? I pushed an update that truncates previous files.
The same log written by different processes could also look weird.
However, there are no internal threads that influence this log: the log is written to by the same thread you use into the API. In other words, the code that appends to the log sits right there with the code for assert_expr, check_sat, etc.

@SolalPirelli
Copy link
Author

OK this one might indeed be my bad, indeed angr creates new solvers, hadn't thought about that 🤦‍♂️ sorry.

Is there a way to set the path of the log per-solver instead of with a global param?

@NikolajBjorner
Copy link
Contributor

Here is an example:

from z3 import *

s1 = Solver()
s2 = Solver()
s1.set("smtlib2_log","log1.smt2")
s2.set("smtlib2_log","log2.smt2")
x = Bool('x')
y = Bool('y')
s1.add(x)
s2.add(y)
s1.check()
s2.check()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants