DEV Community

Discussion on: I'm an Expert in Memory Management & Segfaults, Ask Me Anything!

Collapse
 
vilsenhet profile image
Vilsenhet

Hi Jason! I've been having some trouble with an open source computational chemistry program, maybe you can help. The main program is called Enso (github.com/grimme-lab/enso), but I'm specifically running into the issue with one of the resources included with it. It's the statically compiled binary called anmr. I'm running windows subsystem for linux, Ubuntu 20.10. My PC has 32 gb ram and a Ryzen 7 4800H processor (8 cores).

The issue:
Every time I call the program, even with 'anmr -h' just to bring up the help menu, I get the following output:
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
anmr 000000000180DB13 Unknown Unknown Unknown
anmr 00000000019E2130 Unknown Unknown Unknown
anmr 000000000040A133 Unknown Unknown Unknown
anmr 0000000000403542 Unknown Unknown Unknown
anmr 00000000019E35B0 Unknown Unknown Unknown
anmr 0000000000403427 Unknown Unknown Unknown

What I've already tried:
I'm not the first one to encounter this error, however, everyone else was able to solve it by unlimiting stack size with "ulimit -s unlimited". The short version: it didn't work for me. The long version: I couldn't initially use the command because I didn't have permission to change the stack size hard limit. I managed to change that by altering files such as /etc/security/limits.conf, /etc/pam.d/common-session and so on. When I initially open the terminal, the limit changes don't take effect, but they work when I use "su vilsenhet" even though that's my default profile when I open the terminal. After unlimiting stack size, core file size, etc, calling anmr gives the same segfault error. I reached out to the original programmer for help, and he checked for errors and recompiled the binary for me. It didn't fix the problem. I've tested the archive with 7zip which found no errors. I've added every directory I could think of to my path and LD_LIBRARY_PATH. I've tried a few other longshot fixes I've found by googling the problem, but nothing helps. I'm at a loss.

I'm pretty new to linux and to programming in general, so I really have no idea, but I'm thinking maybe the problem arises from the fact that I have to switch user after my initial login to be able to alter the ulimits, so somehow they don't actually apply to the program when I call it? I don't know. Any insight, tips, or tricks you could offer would greatly be appreciated. Thanks!

Collapse
 
codemouse92 profile image
Jason C. McDonald

First step w/ these is always to compile the program with debug symbols and run it through Valgrind. It's almost impossible to track down the source of the problem without knowing where in the code the program aborts.