LLNL / serac

Serac is a high order nonlinear thermomechanical simulation code
BSD 3-Clause "New" or "Revised" License
190 stars 33 forks source link

Create a signal handler #100

Closed jamiebramwell closed 4 years ago

jamiebramwell commented 4 years ago

Using SCR or Sidre or somethine else, we should be able to handle system signals gracefully.

joshessman-llnl commented 4 years ago

It doesn't look like either SCR or Axom support signal catching directly, so I think it makes sense to install a simple handler that just calls exitGracefully for now - once we have SCR integrated we can also have it checkpoint before terminating.

jamiebramwell commented 4 years ago

I poked the radiuss people on slack to see if there are any other tools we should be aware of. I doubt it, but I'll let you know if I hear anything.

jamiebramwell commented 4 years ago

From @tgamblin on slack: there is libsigsegv — have you looked at that? Problem is that it is GPL. https://www.gnu.org/software/libsigsegv/

Alternately you can just use the backtrace that is in glibc: https://stackoverflow.com/questions/77005/how-to-automatically-generate-a-stacktrace-when-my-program-crashes/77336#77336

white238 commented 4 years ago

https://github.com/LLNL/axom/blob/develop/src/axom/slic/internal/stacktrace.cpp

Axom uses backtrace (and has some windows logic there) to get the stacktraces.

joshessman-llnl commented 4 years ago

We could still do std::signal with SIGSEGV to have slic dump the stack trace before calling exitGracefully, though this will obviously cause problems if it's slic or exitGracefully that's segfaulting.

white238 commented 4 years ago

We could still do std::signal with SIGSEGV to have slic dump the stack trace before calling exitGracefully, though this will obviously cause problems if it's slic or exitGracefully that's segfaulting.

Who watches the Watchmen?