Segmentation Violation

368 views
Skip to first unread message

Guillaume Gaudet

unread,
Feb 19, 2021, 10:00:36 AM2/19/21
to CasADi
Hi,

I have been using CasADi (v3.5.5 on Matlab R2020b, macOS 11.2.1) for an optimal control problem in biomechanics for the past few months. I have been using a NLP solver with MUMPS without any problems. I want to compare with other solvers so I installed the packages from HSL.

I have been able to use the HSL solvers with a simple test problem, so I think the installation was successful. However, when I try to use these solvers for my project, Matlab crashes with a "Segmentation Violation Detected".

I'm trying to understand what is the problem, so any help would be appreciated ! I can contact HSL or Ipopt if this is not a CasADI problem. I attached the matlab crash file and below are the first lines that are printed before the crash. My problem has 19226 variables.

Best regards, 

Guillaume


-----------------
This is Ipopt version 3.12.3, running with linear solver ma97.

Number of nonzeros in equality constraint Jacobian...:        0
Number of nonzeros in inequality constraint Jacobian.:   208262
Number of nonzeros in Lagrangian Hessian.............:   150742
-----------------

Guillaume Gaudet

unread,
Feb 19, 2021, 10:03:52 AM2/19/21
to CasADi
It seems I can't attach the crash file so I will copy it here. Sorry for the long message !

--------------------------------------------------------------------------------
          Segmentation violation detected at 2021-02-19 09:38:12 -0500
--------------------------------------------------------------------------------

Configuration:
  Crash Decoding           : Disabled - No sandbox or build area path
  Crash Mode               : continue (default)
  Default Encoding         : UTF-8
  Deployed                 : false
  Graphics Driver          : Intel Inc. Intel(R) Iris(TM) Plus Graphics OpenGL Engine Version 2.1 INTEL-16.1.11
  Java Version             : Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
  MATLAB Architecture      : maci64
  MATLAB Entitlement ID    : 6257193
  MATLAB Root              : /Applications/Matlab_R2020b.app
  MATLAB Version           : 9.9.0.1467703 (R2020b)
  OpenGL                   : hardware
  Operating System         : Mac OS Version 10.16 (Build 20D74)
  Process ID               : 680
  Processor ID             : x86 Family 6 Model 126 Stepping 5, GenuineIntel
  Session Key              : 0b0d9355-f6cf-44a9-8f8e-2de014fff91d
  Window System            : Quartz

Fault Count: 4


Abnormal termination:
Segmentation violation

Current Thread: 'MCR 0 interpreter thread' id 0x70000c8fc000

Register State (from fault):
  RAX = 000000002321fb70  RBX = 000000002321fb50
  RCX = 00007fdbdc400000  RDX = 00000000001bd9f3
  RSP = 000070000c8f28f0  RBP = 000000000c8f2da8
  RSI = 0000000000000001  RDI = 00007fdc40bc2068

   R8 = 000000000c8f2da8   R9 = 0000000000000001
  R10 = 00007fdc40bc2070  R11 = 00007fdbdc400000
  R12 = 000000002321fb70  R13 = 00007fdc9810d4f0
  R14 = 00007fdc40bc2068  R15 = 0000000000000002

  RIP = 00000002231f1ec0  RFL = 0000000000010283

   CS = 000000000000002b   FS = 0000000000000000   GS = 0000000000000000

Stack Trace (from fault):
[  0] 0x00000001129ba079 /Applications/Matlab_R2020b.app/bin/maci64/libmwfl.dylib+00004217 _ZN10foundation4core4diag15stacktrace_base7captureERKNS1_14thread_contextEm+00000057
[  1] 0x00000001129bf98a /Applications/Matlab_R2020b.app/bin/maci64/libmwfl.dylib+00027018 _ZN10foundation4core4test17terminate_handledERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE+00011546
[  2] 0x00000001129bc9b5 /Applications/Matlab_R2020b.app/bin/maci64/libmwfl.dylib+00014773 _ZN10foundation4core4diag13terminate_logEPKcPK17__darwin_ucontext+00000149
[  3] 0x0000000118219d7b /Applications/Matlab_R2020b.app/bin/maci64/libmwmcr.dylib+00560507 _Z19mnPrintErrorMessageRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+00012427
[  4] 0x000000011821780d /Applications/Matlab_R2020b.app/bin/maci64/libmwmcr.dylib+00550925 _Z19mnPrintErrorMessageRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+00002845
[  5] 0x0000000118215240 /Applications/Matlab_R2020b.app/bin/maci64/libmwmcr.dylib+00541248 mnFatalSignalHandler+00000144
[  6] 0x00007fff204cad7d           /usr/lib/system/libsystem_platform.dylib+00015741 _sigtramp+00000029


Abnormal termination:
Segmentation violation

Current Thread: '' id 0x70001016e000

Register State (from fault):
  RAX = 000000002321fb70  RBX = 000000002321fb50
  RCX = 00007fdc0c400000  RDX = 00000000001bd9f7
  RSP = 000070001016d230  RBP = 000000001016d6e8
  RSI = 0000000000000001  RDI = 00007fdc40bc2048

   R8 = 000000001016d6e8   R9 = 0000000000000001
  R10 = 00007fdc40bc2050  R11 = 00007fdc0c400000
  R12 = 000000002321fb70  R13 = 00007fdc9810d538
  R14 = 00007fdc40bc2048  R15 = 0000000000000002

  RIP = 00000002231f1ec0  RFL = 0000000000010287

   CS = 000000000000002b   FS = 0000000000000000   GS = 0000000000000000

Stack Trace (from fault):
[  0] 0x00000001129ba079 /Applications/Matlab_R2020b.app/bin/maci64/libmwfl.dylib+00004217 _ZN10foundation4core4diag15stacktrace_base7captureERKNS1_14thread_contextEm+00000057
[  1] 0x00000001129bf98a /Applications/Matlab_R2020b.app/bin/maci64/libmwfl.dylib+00027018 _ZN10foundation4core4test17terminate_handledERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE+00011546
[  2] 0x00000001129bc9b5 /Applications/Matlab_R2020b.app/bin/maci64/libmwfl.dylib+00014773 _ZN10foundation4core4diag13terminate_logEPKcPK17__darwin_ucontext+00000149
[  3] 0x0000000118219d7b /Applications/Matlab_R2020b.app/bin/maci64/libmwmcr.dylib+00560507 _Z19mnPrintErrorMessageRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+00012427
[  4] 0x000000011821780d /Applications/Matlab_R2020b.app/bin/maci64/libmwmcr.dylib+00550925 _Z19mnPrintErrorMessageRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+00002845
[  5] 0x0000000118215240 /Applications/Matlab_R2020b.app/bin/maci64/libmwmcr.dylib+00541248 mnFatalSignalHandler+00000144
[  6] 0x00007fff204cad7d           /usr/lib/system/libsystem_platform.dylib+00015741 _sigtramp+00000029


Abnormal termination:
Segmentation violation

Current Thread: '' id 0x700010274000

Register State (from fault):
  RAX = 000000002321fb70  RBX = 000000002321fb50
  RCX = 00007fdbac400000  RDX = 00000000001bd9fb
  RSP = 0000700010273230  RBP = 00000000102736e8
  RSI = 0000000000000001  RDI = 00007fdc40bc2028

   R8 = 00000000102736e8   R9 = 0000000000000001
  R10 = 00007fdc40bc2030  R11 = 00007fdbac400000
  R12 = 000000002321fb70  R13 = 00007fdc9810d580
  R14 = 00007fdc40bc2028  R15 = 0000000000000002

  RIP = 00000002231f1ec0  RFL = 0000000000010287

   CS = 000000000000002b   FS = 0000000000000000   GS = 0000000000000000

Stack Trace (from fault):
[  0] 0x00000001129ba079 /Applications/Matlab_R2020b.app/bin/maci64/libmwfl.dylib+00004217 _ZN10foundation4core4diag15stacktrace_base7captureERKNS1_14thread_contextEm+00000057
[  1] 0x00000001129bf98a /Applications/Matlab_R2020b.app/bin/maci64/libmwfl.dylib+00027018 _ZN10foundation4core4test17terminate_handledERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE+00011546
[  2] 0x00000001129bc9b5 /Applications/Matlab_R2020b.app/bin/maci64/libmwfl.dylib+00014773 _ZN10foundation4core4diag13terminate_logEPKcPK17__darwin_ucontext+00000149
[  3] 0x0000000118219d7b /Applications/Matlab_R2020b.app/bin/maci64/libmwmcr.dylib+00560507 _Z19mnPrintErrorMessageRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+00012427
[  4] 0x000000011821780d /Applications/Matlab_R2020b.app/bin/maci64/libmwmcr.dylib+00550925 _Z19mnPrintErrorMessageRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+00002845
[  5] 0x0000000118215240 /Applications/Matlab_R2020b.app/bin/maci64/libmwmcr.dylib+00541248 mnFatalSignalHandler+00000144
[  6] 0x00007fff204cad7d           /usr/lib/system/libsystem_platform.dylib+00015741 _sigtramp+00000029


Abnormal termination:
Segmentation violation

Current Thread: '' id 0x700011733000

Register State (from fault):
  RAX = 000000002321fb70  RBX = 000000002321fb50
  RCX = 00007fdb7c400000  RDX = 00000000001bd9ff
  RSP = 0000700011732230  RBP = 00000000117326e8
  RSI = 0000000000000001  RDI = 00007fdc40bc2008

   R8 = 00000000117326e8   R9 = 0000000000000001
  R10 = 00007fdc40bc2010  R11 = 00007fdb7c400000
  R12 = 000000002321fb70  R13 = 00007fdc9810d5c8
  R14 = 00007fdc40bc2008  R15 = 0000000000000002

  RIP = 00000002231f1ec0  RFL = 0000000000010283

   CS = 000000000000002b   FS = 0000000000000000   GS = 0000000000000000

Stack Trace (from fault):
[  0] 0x00000001129ba079 /Applications/Matlab_R2020b.app/bin/maci64/libmwfl.dylib+00004217 _ZN10foundation4core4diag15stacktrace_base7captureERKNS1_14thread_contextEm+00000057
[  1] 0x00000001129bf98a /Applications/Matlab_R2020b.app/bin/maci64/libmwfl.dylib+00027018 _ZN10foundation4core4test17terminate_handledERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE+00011546
[  2] 0x00000001129bc9b5 /Applications/Matlab_R2020b.app/bin/maci64/libmwfl.dylib+00014773 _ZN10foundation4core4diag13terminate_logEPKcPK17__darwin_ucontext+00000149
[  3] 0x0000000118219d7b /Applications/Matlab_R2020b.app/bin/maci64/libmwmcr.dylib+00560507 _Z19mnPrintErrorMessageRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+00012427
[  4] 0x000000011821780d /Applications/Matlab_R2020b.app/bin/maci64/libmwmcr.dylib+00550925 _Z19mnPrintErrorMessageRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+00002845
[  5] 0x0000000118215240 /Applications/Matlab_R2020b.app/bin/maci64/libmwmcr.dylib+00541248 mnFatalSignalHandler+00000144
[  6] 0x00007fff204cad7d           /usr/lib/system/libsystem_platform.dylib+00015741 _sigtramp+00000029

Joris Gillis

unread,
Mar 12, 2021, 3:44:08 PM3/12/21
to CasADi
Dear Guillaume,

This is hard to debug.
Your best bet is to compile Ipopt and CasADi from source, with hsl sources added to Ipopt build dir.
Second best bet is to keep using casadi binaries but follow our build recipe for hsl https://github.com/casadi/testbot/blob/master/recipes/hsl_osx.sh

Eventually these issues will go away when we adopt https://github.com/casadi/casadi/issues/2291

Best regards,
  Joris

Guillaume Gaudet

unread,
Mar 12, 2021, 4:17:19 PM3/12/21
to Joris Gillis, CasADi
Dear Joris,

Thank you very much for your answer !
I'm not familiar with building from sources, so I have some quick questions:
- Can I follow this guide to install casadi from source: https://github.com/casadi/casadi/wiki/InstallationMac  ?
- Do I need to delete some stuff from my previous install tries ? For example: hsl files, casadi binaries, metis library, etc.
- Can I run directly the build recipe you linked in a terminal ? 

Sincerely,
Guillaume



--
Sent from CasADi's user forum at http://forum.casadi.org.
---
You received this message because you are subscribed to a topic in the Google Groups "CasADi" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/casadi-users/g-zYjB3uxPQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to casadi-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/casadi-users/05152cdd-1994-42b6-bc48-63372f73da21n%40googlegroups.com.


--
Guillaume Gaudet
M.Sc.A.
École Polytechnique de Montréal
Centre de Réadaptation Marie-Enfant

Joris Gillis

unread,
Mar 12, 2021, 5:37:18 PM3/12/21
to CasADi
Dear Guillaume,

The wiki page is relevant yes, but might not have been kept up to date.
Lingering libraries are always a danger. Remove and restart Matlab.
The link script will not run as-is, rather, use it as source of inspiration.

Best regards,
  Joris

Guillaume Gaudet

unread,
Mar 12, 2021, 10:24:26 PM3/12/21
to Joris Gillis, CasADi
Dear Joris,

Thanks again for your answer and the tips. I will give the installation process another try.

Best,

Guillaume

Reply all
Reply to author
Forward
0 new messages