-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[BUG] Z3_dec_ref is None at program exit point #5656
Comments
If you are unloading the z3 library, as you seem to do, then you would also need to ensure there are no live objects before the library is retired. |
@NikolajBjorner Thanks for the reply. I did not manually unload any libraries including z3. Just wrote a program with many constraints and such kinds of warnings occur. The more constraints I have the more warnings I got. For example the following constraints would lead to the warnings:
|
it's impossible to say without a repro. The stack you show suggests that there is a call to deleting a Context object. |
@NikolajBjorner Thanks for the patience. I just found a minimal sample to repro. It seems to be a compatibility issue with PyTorch. import torch
import z3
if __name__ == '__main__':
p, q, r = z3.Ints('p q r')
s = z3.Solver()
s.add(p > 0)
s.add(p > 0)
s.add(r > 0)
s.add(p > 0)
s.add(p > 0)
s.add(p > 0)
s.add(p > 0)
s.add(r > 0)
s.add(p > 0)
s.add(r > 0)
s.add(r > 0)
s.add(q > 0)
s.add(p > 0)
s.add(p > 0)
s.add(p > 0)
print(s)
s.check()
s.check()
s.check()
s.check() |
@NikolajBjorner Found a workaround. It works fine if I import z3 first. I am not sure why this happens. Thanks for your patience. |
I tried to repro on my Windows 11: C:\z3\build\python>python t.py It exits cleanly. It could also relate to version of torch being used. I installed a fresh version right now. |
My environment is Linux (Manjaro) and I am using PyTorch 1.10 with CUDA 11.3 support.
In addition to PyTorch, graphviz is also not compatible with z3 as you see in my second reply. My current workaround is to only generate a graph descriptor and use external executable binary (i.e., |
This bug seems to only occur on my PC. I tried it on Colab and it works fine. |
I tried with both torch and graphviz on my end (and it has been tested in many other settings before). |
I have this issue as well - happens whenever there's some error in my code or if I call exit(). |
The function object
Z3_dec_ref
becomes None at the program exit point thus producing many annoying messages.System environment:
OS: Linux ise-manjaro 5.10.70-1-MANJARO #1 SMP PREEMPT Thu Sep 30 15:29:01 UTC 2021 x86_64 GNU/Linux
Python version: 3.8
Relevant issues: #989
The text was updated successfully, but these errors were encountered: