Opened 7 years ago

Last modified 6 years ago

#20360 new enhancement

Add sig_on/sig_off to COINBackend

Reported by: Matthias Köppe Owned by:
Priority: major Milestone: sage-7.2
Component: numerical Keywords: lp
Cc: Dima Pasechnik, Vincent Delecroix, Jeroen Demeyer Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by Matthias Köppe)

The COIN backend needs sig_on, sig_off throughout so that bounds errors do not crash Sage.

sage: p = get_solver(solver = "Coin")
sage: p.is_variable_continuous(1234567)
True
sage: p.add_linear_constraint([(123, 456.7)], None, 0)
... 
Unhandled SIGSEGV: A segmentation fault occurred.

Another one, from #20326:

sage: coeffs = ([0, vector([1, 2])], [1, vector([2, 3])])
sage: upper = vector([5, 5])
sage: lower = vector([0, 0])
sage: from sage.numerical.backends.generic_backend import get_solver
sage: p = get_solver(solver = "Coin")       # optional - cbc
sage: p.add_linear_constraint_vector(2, coeffs, lower, upper)

Change History (3)

comment:1 Changed 7 years ago by Matthias Köppe

Description: modified (diff)

comment:2 Changed 6 years ago by Jeroen Demeyer

I don't think this is a matter of adding sig_on/sig_off. Letting a program segfault and then catching the segfault is not a proper way of handling errors.

You should just check invalid input before calling COIN.

That being said, it might still be a good idea to add the sig_on/sig_off but not as a substitute for input checking.

comment:3 in reply to:  2 Changed 6 years ago by Dima Pasechnik

Replying to jdemeyer:

I don't think this is a matter of adding sig_on/sig_off. Letting a program segfault and then catching the segfault is not a proper way of handling errors.

You should just check invalid input before calling COIN.

IMHO it's rather the backend's task (and that's more pythonic, if you ask me). They should check for such things, and perhaps they will fix it at some point.

That being said, it might still be a good idea to add the sig_on/sig_off but not as a substitute for input checking.

Note: See TracTickets for help on using tickets.