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

Add GC-safe region around Highs_run #178

Merged
merged 2 commits into from
Oct 5, 2023
Merged

Conversation

kpamnany
Copy link
Contributor

@kpamnany kpamnany commented Oct 4, 2023

Prevent a long-running Highs_run call from blocking GC (and freezing other Julia threads). Ref: JuliaLang/julia#51574

Questions:

  • Does Highs_run call back into Julia?
  • Is this the only call that can run for minutes?

@odow
Copy link
Member

odow commented Oct 5, 2023

Does Highs_run call back into Julia?

Not currently, but it may do in future.

Is this the only call that can run for minutes?

There are other calls, but we don't use them at the moment.

Let me take a deeper look at this PR. I would prefer that we put the region around

ret = Highs_run(model)

and left the automatically built libhighs.jl alone

Prevent a long-running `Highs_run` call from blocking GC (and
freezing the other Julia threads).
@kpamnany
Copy link
Contributor Author

kpamnany commented Oct 5, 2023

Moved the region to MOI_wrapper.jl.

src/MOI_wrapper.jl Outdated Show resolved Hide resolved
@odow
Copy link
Member

odow commented Oct 5, 2023

Did you find this instance because of some benchmark? I guess this might actually be a problem for most of the JuMP solvers

@codecov
Copy link

codecov bot commented Oct 5, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (7316ac9) 83.31% compared to head (3dadf96) 83.34%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #178      +/-   ##
==========================================
+ Coverage   83.31%   83.34%   +0.03%     
==========================================
  Files           3        3              
  Lines        1630     1633       +3     
==========================================
+ Hits         1358     1361       +3     
  Misses        272      272              
Files Coverage Δ
src/MOI_wrapper.jl 94.12% <100.00%> (+0.01%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kpamnany
Copy link
Contributor Author

kpamnany commented Oct 5, 2023

I work at RelationalAI; we're using Julia to build our product. The freeze I mention happened to us. 😢

This is likely a problem with the other solvers as well, as well as any package that wraps an external library (i.e. uses ccall) that implements possibly long-running logic.

@kpamnany
Copy link
Contributor Author

kpamnany commented Oct 5, 2023

Can I request a new patch release with this fix?

@odow
Copy link
Member

odow commented Oct 5, 2023

I work at RelationalAI

Ah 😄

What other solvers do you need me to look at?

Can I request a new patch release with this fix?

Yip

@odow odow merged commit c08ca53 into jump-dev:master Oct 5, 2023
6 checks passed
@kpamnany
Copy link
Contributor Author

kpamnany commented Oct 5, 2023

What other solvers do you need me to look at?

Let me get back on that one.

Thanks very much!

@kpamnany kpamnany deleted the kp-add-gc-safe branch October 5, 2023 12:38
@kpamnany
Copy link
Contributor Author

kpamnany commented Oct 6, 2023

Here are other jump-dev solvers that are relevant to us, but don't need an immediate fix:

  • Gurobi
  • Pavito
  • MiniZinc
  • Ipopt

Cc: @bachdavi

@odow
Copy link
Member

odow commented Oct 7, 2023

I think these are all safe:

  • Gurobi: calls back into Julia from C
  • Pavito: written in Julia
  • MiniZinc: calls a binary via run
  • Ipopt: calls back into Julia from C

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants