RedisGraph
RedisGraph copied to clipboard
SIGSEGV handler
This is an example of how we might be able to handle one of the common exceptions we encounter (invalid memory access) the API resembles the Try/Catch mechanism.
The idea is to install a single handler for SIGSEGV in addition to a long-jump point, such that if the single handler is called i.e. we've access an invalid memory address execution of the offending thread will jump to the "recovery" point.
Shortcomings: depending on the "try/catch" block scope, we might be leaking or leave the graph or one of its components in an invalid state, so use with care!
Is this better than crashing and losing data? maybe...
I believe that crashing is better than undefined behavior.