Github user jodersky commented on a diff in the pull request:
https://github.com/apache/spark/pull/12557#discussion_r60699904
--- Diff: core/src/main/scala/org/apache/spark/util/SignalLogger.scala ---
@@ -17,44 +17,20 @@
package org.apache.spark.util
-import org.apache.commons.lang3.SystemUtils
import org.slf4j.Logger
-import sun.misc.{Signal, SignalHandler}
/**
* Used to log signals received. This can be very useful in debugging
crashes or kills.
- *
- * Inspired by Colin Patrick McCabe's similar class from Hadoop.
*/
private[spark] object SignalLogger {
private var registered = false
/** Register a signal handler to log signals on UNIX-like systems. */
- def register(log: Logger): Unit = synchronized {
- if (SystemUtils.IS_OS_UNIX) {
- require(!registered, "Can't re-install the signal handlers")
- registered = true
-
- val signals = Seq("TERM", "HUP", "INT")
- for (signal <- signals) {
- try {
- new SignalLoggerHandler(signal, log)
- } catch {
- case e: Exception => log.warn("Failed to register signal handler
" + signal, e)
- }
- }
- log.info("Registered signal handlers for [" + signals.mkString(", ")
+ "]")
+ def register(log: Logger): Unit = Seq("TERM", "HUP", "INT").foreach{ sig
=>
+ Signaling.register(sig) {
--- End diff --
o.a.s.util.Signaling takes care of enforcing single instantiation of a
handler per jvm. Do you mean the specific case of double registering logging?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]