kul-optec / alpaqa

Library for nonconvex constrained optimization using the augmented Lagrangian method and the matrix-free PANOC algorithm.
GNU Lesser General Public License v3.0
64 stars 7 forks source link

Running the problem fails with stack smashing detected #4

Closed truncs closed 11 months ago

truncs commented 1 year ago

While running the example mpc bicycle problem alpaqa results in stack smashing detected

(env) aditya@aditya-desktop:~/workspace/alpaqa/examples/mpc/python/bicycle$ python3 bicycle-obstacle-avoidance-mpc.py 
*** stack smashing detected ***: <unknown> terminated
Aborted (core dumped)

NOTE: The example file has some syntax error, so I had to fix that.

I tried reinstalling alpaqa but that doesn't help

(env) aditya@aditya-desktop:~/workspace/alpaqa/examples/mpc/python/bicycle$ pip3 install --force alpaqa
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Collecting alpaqa
  Downloading alpaqa-0.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_27_x86_64.whl (3.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.7/3.7 MB 40.4 MB/s eta 0:00:00
Collecting cmake
  Downloading cmake-3.24.1.1-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (23.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 23.3/23.3 MB 96.3 MB/s eta 0:00:00
Collecting casadi
  Downloading casadi-3.5.5-cp38-none-manylinux1_x86_64.whl (34.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 34.2/34.2 MB 91.0 MB/s eta 0:00:00
Collecting numpy
  Downloading numpy-1.23.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.1/17.1 MB 106.5 MB/s eta 0:00:00
Collecting ninja
  Downloading ninja-1.10.2.4-py2.py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl (120 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 120.7/120.7 kB 200.8 MB/s eta 0:00:00
Installing collected packages: ninja, cmake, casadi, numpy, alpaqa
  Attempting uninstall: ninja
    Found existing installation: ninja 1.10.2.3
    Uninstalling ninja-1.10.2.3:
      Successfully uninstalled ninja-1.10.2.3
  Attempting uninstall: cmake
    Found existing installation: cmake 3.24.1.1
    Uninstalling cmake-3.24.1.1:
      Successfully uninstalled cmake-3.24.1.1
  Attempting uninstall: casadi
    Found existing installation: casadi 3.5.5
    Uninstalling casadi-3.5.5:
      Successfully uninstalled casadi-3.5.5
  Attempting uninstall: numpy
    Found existing installation: numpy 1.23.3
    Uninstalling numpy-1.23.3:
      Successfully uninstalled numpy-1.23.3
  Attempting uninstall: alpaqa
    Found existing installation: alpaqa 0.0.1
    Uninstalling alpaqa-0.0.1:
      Successfully uninstalled alpaqa-0.0.1
Successfully installed alpaqa-0.0.1 casadi-3.5.5 cmake-3.24.1.1 ninja-1.10.2.4 numpy-1.23.3

[notice] A new release of pip available: 22.2 -> 22.2.2
[notice] To update, run: pip install --upgrade pip
(env) aditya@aditya-desktop:~/workspace/alpaqa/examples/mpc/python/bicycle$ python3 bicycle-obstacle-avoidance-mpc.py 
*** stack smashing detected ***: <unknown> terminated
Aborted (core dumped)

Casadi with other ipot seems to be working fine.

Thoughts? Or should this be part of casadi?

tttapa commented 11 months ago

Thank you for the report.
The root cause was the lifetime of a temporary in an Eigen expression template in a generic function. This issue has since been fixed on the develop branch and in the 1.0 pre-releases of alpaqa.

I have improved the continuous integration to include tests under Valgrind, and with all stack canaries enabled to avoid similar issues in the future.

truncs commented 11 months ago

Thank you for looking into this!