Skip to content

Setting threads parameter leads to Cbc crash #303

@Sceriffo

Description

@Sceriffo

Describe the bug
Setting threads parameter using model's setter method doesn't work and leads to crash of Cbc at the end of computation.

ERROR while running Cbc. Signal SIGSEGV caught. Getting stack trace.
...
python3(_PyObject_MakeTpCall+0x296) [0x5f74f6]
python3(_PyEval_EvalFrameDefault+0x5dc4) [0x571164]
python3(_PyEval_EvalCodeWithName+0x26a) [0x569dba]
python3(_PyFunction_Vectorcall+0x393) [0x5f6eb3]
python3(_PyEval_EvalFrameDefault+0x85a) [0x56bbfa]
python3(_PyEval_EvalCodeWithName+0x26a) [0x569dba]
python3(_PyFunction_Vectorcall+0x393) [0x5f6eb3]
python3(_PyEval_EvalFrameDefault+0x85a) [0x56bbfa]
python3(_PyFunction_Vectorcall+0x1b6) [0x5f6cd6]
python3(_PyEval_EvalFrameDefault+0x72d) [0x56bacd]
python3(_PyEval_EvalCodeWithName+0x26a) [0x569dba]
python3(_PyFunction_Vectorcall+0x393) [0x5f6eb3]
python3(_PyEval_EvalFrameDefault+0x72d) [0x56bacd]
python3(_PyEval_EvalCodeWithName+0x26a) [0x569dba]
python3(PyEval_EvalCode+0x27) [0x6902a7]
python3() [0x67f951]
python3() [0x67f9cf]
python3() [0x67fa71]
python3(PyRun_SimpleFileExFlags+0x197) [0x681b97]
python3(Py_RunMain+0x212) [0x6b9d32]
python3(Py_BytesMain+0x2d) [0x6ba0bd]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7f92f51de083]
python3(_start+0x2e) [0x5fc5fe]

To Reproduce

model.threads = 2
model.optimize()

Expected behavior
Threads limited to 2 and Cbc oesn't crash

Desktop (please complete the following information):

  • Operating System, version: Ubuntu 20.04.4 LTS
  • Python version: 3.8.10
  • Python-MIP version (we recommend you to test with the latest version): 1.14.1

Additional context
I notice that it works fine by using the Cbc wrapped method. Like:

cbc_set_parameter(model.solver, "threads", "{}".format(2))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions