-
Notifications
You must be signed in to change notification settings - Fork 63
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
REPL crashing on ctrl+c? #45
Comments
Yeah I see this as well, I mostly use CPLEX but I think I've noticed it for other solvers as well. I have pretty much no idea how to work around this though, but @mlubin maybe has some thoughts? |
I've seen similar issues but haven't been following the state of signal Yeah I see this as well, I mostly use CPLEX but I think I've noticed it for — |
might need some |
So just wrapping e.g. stat = disable_sigint() do
@cpx_ccall(mipopt, Cint, (Ptr{Void}, Ptr{Void}), model.env.ptr, model.lp)
end means CPLEX just keeps running after CTRL+C, which IMO is less desirable than a brutal segfault. Ideally we'd want to propagate the SIGINT to CPLEX so it can fail gracefully, but I'm not certain how to do that. |
The CPLEX callable library does provide a function to terminate it gracefully: http://www-01.ibm.com/support/knowledgecenter/SSSA5P_12.6.2/ilog.odms.cplex.help/refcallablelibrary/cpxapi/setterminate.html?cp=SSSA5P_12.6.2%2F2-8-0-30-2&lang=en |
Looks like maybe we could do something like this: try
@cpx_ccall(mipopt, Cint, (Ptr{Void}, Ptr{Void}), model.env.ptr, model.lp)
catch ex
if isa(ex, InterruptException)
@cpx_ccall(setterminate, Cint, (Ptr{Void}, Ptr{Void}), model.env.ptr, CPLEX_SIGINT)
else
rethrow(ex)
end
end (ref http://stackoverflow.com/questions/20831290/julia-handle-keyboard-interrupt) |
I don't know what |
In my not too exhaustive testing, ab71579 seems to give the expected behavior now. Reopen if I'm wrong! |
I'm sure it's a known issue, but ctrl+c causes the REPL to crash (brutal segfault).
[If it only happens to me, I'd like to find out why :)]
Related: with Gurobi, ctrl+c takes me back to the REPL but the solver keeps running in the background, until it completes (or you quit the REPL) -- only marginally less annoying than a crash. Should probably open an issue there as well, if there isn't one already.
The text was updated successfully, but these errors were encountered: