-
Notifications
You must be signed in to change notification settings - Fork 81
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
Gurobi.free_env segfaults with low probability #110
Comments
I can reproduce this on Windows.
using Gurobi, JuMP
while true
env = Gurobi.Env()
m = Model(solver=GurobiSolver(env, OutputFlag=0))
@variable m x
@objective m Min x^2
solve(m)
sleep(0.1)
Gurobi.free_env(env)
end It just took a really long time. |
By the way, I'm still getting this from time to time. The only reliable solution has been to never ever free a Gurobi environment. |
Related: JuliaLang/julia#3067 |
If you are using The current suggested version of the original MWE is: using Gurobi, JuMP
while true
env = Gurobi.Env()
model = Model(() -> Gurobi.Optimizer(env))
set_silent(model)
@variable(model, x)
@objective(model, Min, x^2)
optimize!(model)
# To ensure `env` is finalized, you must also finalize any models using env.
# If you use `Gurobi.Optimizer`, the order of finalizing `.model` and `env`
# doesn't matter. If you use the C API directly, `.model` _MUST_ be
# finalized first.
finalize(backend(model).optimizer.model)
finalize(env)
end |
Running the following:
causes Julia to segfault after a few seconds with:
gdb shows the following:
I'm running the following Julia version:
and the following Gurobi version:
I'm not entirely sure that this is a Gurobi.jl issue, but I have noticed that just constructing and freeing environments seems to work fine. That is, the following does not crash:
The text was updated successfully, but these errors were encountered: