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

Fix hanging when solver exits with a non-zero exit code #821

Merged
merged 8 commits into from
Dec 6, 2023

Conversation

atomb
Copy link
Collaborator

@atomb atomb commented Dec 5, 2023

Previously, if the solver quit abruptly with a non-zero exit code (such as for a segmentation fault), Boogie would hang. These changes turn that into a well-behaved solver exception.

@@ -74,6 +75,10 @@ public SMTLibProcess(SMTLibOptions libOptions, SMTLibSolverOptions options)

private void SolverExited(object sender, EventArgs e)
{
if (options.Verbosity >= 2) {
Console.WriteLine($"[SMT-ERR-{{0}}] Solver exited with code {solver.ExitCode}.");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd ask you to avoid calls to Console., but I see this file already contains them ^,^

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we should refactor it to use something more parameterized.

@keyboardDrummer keyboardDrummer enabled auto-merge (squash) December 6, 2023 13:52
@keyboardDrummer
Copy link
Collaborator

keyboardDrummer commented Dec 6, 2023

Looks amazing. How did you find this?

Also, I added a commit to increment the version.

@keyboardDrummer keyboardDrummer merged commit 4896769 into boogie-org:master Dec 6, 2023
4 checks passed
@atomb
Copy link
Collaborator Author

atomb commented Dec 6, 2023

Looks amazing. How did you find this?

It was a rather frustrating bout of debugging, I must say! I've known that this was an issue for a while, and I expected that the SolverExited code would be run when the solver had a segfault, so I kept putting either breakpoints or print statements there and never having them executed. So, IIRC, I think I read a bunch of the documentation for Process and came across the EnableRaisingEvents property. I actually created this branch a month or so ago and held off creating a PR while I figured out how to create a test that intentionally crashed without needing to compile some C code in the test suite. And then I realized it didn't need to segfault, just return non-zero, so /usr/bin/false does the trick.

Also, I added a commit to increment the version.

Thanks!

@atomb atomb deleted the fix-z3-segfault-hang branch January 4, 2024 16:30
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

Successfully merging this pull request may close these issues.

2 participants