Skip to content

Preserve problem arrays and ownership after allocation failure - #224

Open
reinhardullrich wants to merge 1 commit into
scipopt:v101-bugfixfrom
reinhardullrich:fix/problem-array-allocation-failure
Open

reinhardullrich wants to merge 1 commit into
scipopt:v101-bugfixfrom
reinhardullrich:fix/problem-array-allocation-failure

Conversation

@reinhardullrich

Copy link
Copy Markdown

Problem and fix

An allocation failure while growing a problem's variable or constraint array can lead to SIGSEGV in SCIPprobFree() during cleanup. BMSreallocMemoryArray assigns its null return directly to the owned pointer, losing access to an existing array even though it still contains live objects.

Grow the five problem arrays through temporary pointers and commit them only after success. Also defer the problem's variable capture and the constraint's array-position assignment until the required capacity is available. Successful growth retains the same capacity policy and solver behavior.

Regression and validation

A standalone Linux/shared-library regression injects one failed problem-array resize using executable-local symbol interposition. It checks both variable and constraint insertion, the SCIP_NOMEMORY return, retained object ownership, and successful cleanup. It needs neither a large allocation nor Criterion; assertions stay enabled in Release and core dumps are disabled.

  • Unpatched SCIP 10.1.0: both cases reproduce SIGSEGV.
  • SCIP 10.1.0 with this patch: both cases pass, including ownership/position checks.
  • Release build with exact solving enabled, GCC on Linux aarch64.
  • ctest --test-dir build -R '^problem_array_allocation_failure$' --output-on-failure passes.
  • A separate application-worker probe now reports memory exhaustion and exits normally for the same injected constraint-array failure.

This is scoped to problem-array growth. It does not claim to fix every allocation-failure path, GMP allocation aborts, or general memory-limit enforcement. No public API, parameter, or solver formulation changes. No performance benchmark was run.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant