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

Segfault with small time limit #1990

Closed
odow opened this issue Oct 23, 2024 · 7 comments
Closed

Segfault with small time limit #1990

odow opened this issue Oct 23, 2024 · 7 comments

Comments

@odow
Copy link
Collaborator

odow commented Oct 23, 2024

Originally reported as jump-dev/HiGHS.jl#240

MPS file: time_crash.mps.txt

Very reproducible in HiGHS v1.7.2 and v1.8.0, on both Windows and Mac, and every time.

julia> HiGHS_jll.highs() do exe
       run(`$exe time_crash.mps --time_limit 0.1`)
       end
Running HiGHS 1.8.0 (git hash: fcfb53414): Copyright (c) 2024 HiGHS under MIT licence terms
QP   time_crash has 8440 rows; 5871 cols; 24016 matrix nonzeros; 5871 Hessian nonzeros
Coefficient ranges:
  Matrix [2e-01, 1e+03]
  Cost   [8e+02, 7e+03]
  Bound  [4e-03, 1e+03]
  RHS    [2e-03, 1e+00]
  Iteration        Objective     NullspaceDim
ERROR: failed process: Process(`/Users/oscar/.julia/artifacts/6c052094bcce703903faeccc27a66f3453fd061e/bin/highs time_crash.mps --time_limit 0.1`, ProcessSignaled(11)) [0]

The Julia log makes it look like is related to HighsTimerClock during the buildSimple call in factorization:

[1610] signal (11.1): Segmentation fault: 11
in expression starting at REPL[6]:1
_ZN7HFactor11buildSimpleEv at /Users/oscar/.julia/artifacts/6c052094bcce703903faeccc27a66f3453fd061e/lib/libhighs.1.8.dylib (unknown line)
_ZN7HFactor5buildEP15HighsTimerClock at /Users/oscar/.julia/artifacts/6c052094bcce703903faeccc27a66f3453fd061e/lib/libhighs.1.8.dylib (unknown line)
_ZN5Basis5buildEv at /Users/oscar/.julia/artifacts/6c052094bcce703903faeccc27a66f3453fd061e/lib/libhighs.1.8.dylib (unknown line)
_ZN5BasisC2ER7RuntimeNSt3__16vectorIiNS2_9allocatorIiEEEENS3_I11BasisStatusNS4_IS7_EEEES6_ at /Users/oscar/.julia/artifacts/6c052094bcce703903faeccc27a66f3453fd061e/lib/libhighs.1.8.dylib (unknown line)
_Z14solveqp_actualR8InstanceR8SettingsR21QpHotstartInformationR10StatisticsR13QpModelStatusR10QpSolutionR10HighsTimer at /Users/oscar/.julia/artifacts/6c052094bcce703903faeccc27a66f3453fd061e/lib/libhighs.1.8.dylib (unknown line)
_Z7solveqpR8InstanceR8SettingsR10StatisticsR16HighsModelStatusR10HighsBasisR13HighsSolutionR10HighsTimer at /Users/oscar/.julia/artifacts/6c052094bcce703903faeccc27a66f3453fd061e/lib/libhighs.1.8.dylib (unknown line)
_ZN5Highs11callSolveQpEv at /Users/oscar/.julia/artifacts/6c052094bcce703903faeccc27a66f3453fd061e/lib/libhighs.1.8.dylib (unknown line)
_ZN5Highs3runEv at /Users/oscar/.julia/artifacts/6c052094bcce703903faeccc27a66f3453fd061e/lib/libhighs.1.8.dylib (unknown line)
@fwesselm
Copy link
Contributor

I think the QP code does not check that HiGHS hit the time limit in computeStartingPointHighs. Also, I think the code may try to set a negative time limit for HiGHS. I have tried to fix this (https://github.com/fwesselm/HiGHS/tree/QpTimeLimit), but I do not know the QP code well.

@jajhall
Copy link
Member

jajhall commented Oct 23, 2024

Thanks @odow and @fwesselm , I'll look at this today

@jajhall
Copy link
Member

jajhall commented Oct 23, 2024

I think the QP code does not check that HiGHS hit the time limit in computeStartingPointHighs. Also, I think the code may try to set a negative time limit for HiGHS. I have tried to fix this (https://github.com/fwesselm/HiGHS/tree/QpTimeLimit), but I do not know the QP code well.

I see where a negative value of use_time_limit might be set. Other than to modification in

const double use_time_limit =
    settings.time_limit < kHighsInf
        ? std::max(settings.time_limit - timer.readRunHighsClock(), 0.0)
        : kHighsInf;

I don't see any other meaningful changes - every other change seems to be due to formatting.

Now that @feldmeier is not supporting the QP solver, I'll apply clang formatting to it.

Could the qpsolver/* files be added to the clang test on GitHub @galabovaa ?

@fwesselm
Copy link
Contributor

Sorry, I realized that the code was auto-formatted while I was editing it.

The second change is to check whether computeStartingPointHighs returned an error:

if (qp_model_status == QpModelStatus::kError) return QpAsmStatus::kError;

@fwesselm
Copy link
Contributor

I think the QP code does not check that HiGHS hit the time limit in computeStartingPointHighs. Also, I think the code may try to set a negative time limit for HiGHS. I have tried to fix this (https://github.com/fwesselm/HiGHS/tree/QpTimeLimit), but I do not know the QP code well.

I see where a negative value of use_time_limit might be set. Other than to modification in

const double use_time_limit =
    settings.time_limit < kHighsInf
        ? std::max(settings.time_limit - timer.readRunHighsClock(), 0.0)
        : kHighsInf;

I don't see any other meaningful changes - every other change seems to be due to formatting.

Now that @feldmeier is not supporting the QP solver, I'll apply clang formatting to it.

Could the qpsolver/* files be added to the clang test on GitHub @galabovaa ?

I have updated the branch now. Sorry for creating the extra work. I could create a PR, if you think the changes are reasonable.

@jajhall
Copy link
Member

jajhall commented Oct 23, 2024

Sorry @fwesselm I've done a lot more - the code wasn't handling interrupts or timeouts - and will run clang formatting so I don't conflict with the changes @galabovaa has made on latest

@jajhall jajhall mentioned this issue Oct 23, 2024
@jajhall
Copy link
Member

jajhall commented Oct 23, 2024

Closed by #1995

@jajhall jajhall closed this as completed Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants