C API execute blocks: non-Go code set up signal handler without SA_ONSTACK flag
canepat opened this issue · comments
If you launch Silkworm C API block execution on Linux from Go code and then hit CTRL-C, you may sometimes encounter the following unhandled exception:
signal 2 received but handler not on signal stack
fatal error: non-Go code set up signal handler without SA_ONSTACK flag
This is because the Go runtime expects its signal handlers to be called on their dedicated signal stack, as stated in Go documentation:
If the non-Go code installs any signal handlers, it must use the SA_ONSTACK flag with sigaction. Failing to do so is likely to cause the program to crash if the signal is received. Go programs routinely run with a limited stack, and therefore set up an alternate signal stack.