-
Notifications
You must be signed in to change notification settings - Fork 73
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
fix --early-exit #437
base: main
Are you sure you want to change the base?
fix --early-exit #437
Conversation
Things I checked:
Things I still need to check:
|
@@ -0,0 +1,174 @@ | |||
import json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no changes here, just moving build-related functionality out of __main__.py
and into its own module
@@ -0,0 +1,160 @@ | |||
import io |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no changes here, just moving trace-related functionality out of __main__.py
and into its own module
@@ -0,0 +1,217 @@ | |||
import concurrent.futures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new module that provides an executor/futures abstraction layer built on top of subprocess.Popen
return SolverOutput.from_result(stdout, stderr, returncode, path_ctx) | ||
|
||
|
||
def solve_end_to_end(ctx: PathContext) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
used to be gen_model_from_sexpr
@dataclass(frozen=True) | ||
class PathContext: | ||
# id of this path | ||
path_id: int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
roughly corresponds to the old iteration idx
|
||
refined_ctx = ctx.refine() | ||
|
||
if refined_ctx.query.smtlib != query.smtlib: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
related: #279
@@ -1411,6 +817,8 @@ def _main(_args=None) -> MainResult: | |||
# | |||
|
|||
def on_exit(exitcode: int) -> MainResult: | |||
ExecutorRegistry().shutdown_all() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what's going on, this sounds like a safe thing to do (shut down external processes) but when I do this I can somewhat consistently get the following crash when triggering a ctrl-c at the right time:
halmos --root ~/projects/halmos-sandbox --function test_manyCexes --solver-command "yices-smt2 --smt2-model-format" --early-exit ✘ INT took 4s
[⠢] Compiling...
No files changed, compilation skipped
Running 1 tests for test/60_manyCexes.t.sol:Test60
setup: 0.01s (decode: 0.01s)
Generating SMT queries in /tmp/test_manyCexes-2459149073354744aa4b653b5fb94c9f
^C
Shutting down all executors
ASSERTION VIOLATION
File: ../src/ast/ast.cpp
Line: 406
UNEXPECTED CODE WAS REACHED.
Z3 4.12.6.0
Please file an issue with this message and more detail about how you encountered it at https://github.com/Z3Prover/z3/issues/new
(note that the interrupted assertion solver is yices, not z3 -- I don't understand why z3 is involved in this)
fixes #243
high-level notes:
thread_pool.shutdown(wait=False)
was not what we needed it to be)PopenExecutor.shutdown(wait=False)
, it does terminate/kill every process that has been submitted to that executor and is still runningsolve_end_to_end
function calls to a thread pool, but that functions submitssolve_low_level
calls to the executor and blocks on the result.solve_low_level
can be interrupted if the underlying process returns, times out, gets killed, etc -- this is the key architectural change--solver-command
defaults toz3
) and we need to parse the model values from the smtlib output. This means we no longer printCounterexample: see xyz.smt2
Additionally, to make the transition to this model easier I introduced a hierarchy of context objects: