-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Avoid adding SegfaultLogger if process already has sig handler. #13842
Conversation
In current implemenation, we override signal handler regardless if MXNET_USE_SIGNAL_HANDLER=1. This breaks caller process behavior and cause process exit unexpectedly. The example use case is libmxnet.so is loadded into java process via JNI or JNA. JVM will crash due to SegfaultLogger. In this PR, we will not register SegfaultLogger if there is a signal handler registered.
@mxnet-label-bot add [pr-awaiting-review] |
@mxnet-label-bot add [pr-awaiting-review] |
@frankfliu Have you tried to build Scala if have that flag=1? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Through the discussion offline with @frankfliu . This change would help JVM and all other process that consume libmxnet.so
not messed up with multiple SignalHandling request. Idealy we should always kept it open for all build process since the MXNet Engine would bring useful information of the log of segfault.
This will not have any side effect to Python package as it did not do a register in the process with Signal Handler
Reference:
https://stackoverflow.com/questions/17102919/is-it-valid-to-have-multiple-signal-handlers-for-same-signal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
FYI: there is a stackoverflow discussion related to this: https://stackoverflow.com/questions/11871693/checking-for-installed-signal-handler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw two StackOverflow links going around in the comments on the PR.
Can these be added to comments in code around the if block here ?
It's fine for them to be in the PR as well, but having those in code will improve it's readability :)
Good catch. So the JVM has a handler for segfault installed? |
…he#13842) In current implemenation, we override signal handler regardless if MXNET_USE_SIGNAL_HANDLER=1. This breaks caller process behavior and cause process exit unexpectedly. The example use case is libmxnet.so is loadded into java process via JNI or JNA. JVM will crash due to SegfaultLogger. In this PR, we will not register SegfaultLogger if there is a signal handler registered.
…he#13842) In current implemenation, we override signal handler regardless if MXNET_USE_SIGNAL_HANDLER=1. This breaks caller process behavior and cause process exit unexpectedly. The example use case is libmxnet.so is loadded into java process via JNI or JNA. JVM will crash due to SegfaultLogger. In this PR, we will not register SegfaultLogger if there is a signal handler registered.
…he#13842) In current implemenation, we override signal handler regardless if MXNET_USE_SIGNAL_HANDLER=1. This breaks caller process behavior and cause process exit unexpectedly. The example use case is libmxnet.so is loadded into java process via JNI or JNA. JVM will crash due to SegfaultLogger. In this PR, we will not register SegfaultLogger if there is a signal handler registered.
…he#13842) In current implemenation, we override signal handler regardless if MXNET_USE_SIGNAL_HANDLER=1. This breaks caller process behavior and cause process exit unexpectedly. The example use case is libmxnet.so is loadded into java process via JNI or JNA. JVM will crash due to SegfaultLogger. In this PR, we will not register SegfaultLogger if there is a signal handler registered.
…he#13842) In current implemenation, we override signal handler regardless if MXNET_USE_SIGNAL_HANDLER=1. This breaks caller process behavior and cause process exit unexpectedly. The example use case is libmxnet.so is loadded into java process via JNI or JNA. JVM will crash due to SegfaultLogger. In this PR, we will not register SegfaultLogger if there is a signal handler registered.
Description
In current implemenation, we override signal handler regardless if MXNET_USE_SIGNAL_HANDLER=1.
This breaks caller process behavior and cause process exit unexpectedly.
The example use case is libmxnet.so is loadded into java process via JNI or JNA. JVM will crash
due to SegfaultLogger.
In this PR, we will not register SegfaultLogger if there is a signal handler registered.
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.