Bug: [JDK17] Remove usage of sun.misc.Signal
Status: Open | Priority: Major | Resolution: 
Created: 07/Nov/24 12:11

when we build hadoop in JDK11 runtime based on [https://github.com/apache/hadoop/pull/7085|https://github.com/apache/hadoop/pull/7085,] JDK11 build is failing as flowing due to: {{package sun.misc does not exist}} in.

 

This is because that package sun.misc is not supported after jdk11.
{code:java}
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project hadoop-common: Compilation failure: Compilation failure: 
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/SignalLogger.java:[22,16] package sun.misc does not exist
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/SignalLogger.java:[23,16] package sun.misc does not exist
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/SignalLogger.java:[44,43] cannot find symbol
[ERROR]   symbol:   class SignalHandler
[ERROR]   location: class org.apache.hadoop.util.SignalLogger
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/SignalLogger.java:[46,19] cannot find symbol
[ERROR]   symbol:   class SignalHandler
[ERROR]   location: class org.apache.hadoop.util.SignalLogger.Handler
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/SignalLogger.java:[59,24] cannot find symbol
[ERROR]   symbol:   class Signal
[ERROR]   location: class org.apache.hadoop.util.SignalLogger.Handler
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/service/launcher/IrqHandler.java:[26,16] package sun.misc does not exist
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/service/launcher/IrqHandler.java:[27,16] package sun.misc does not exist
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/service/launcher/IrqHandler.java:[42,42] cannot find symbol
[ERROR]   symbol: class SignalHandler
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/service/launcher/IrqHandler.java:[71,11] cannot find symbol
[ERROR]   symbol:   class Signal
[ERROR]   location: class org.apache.hadoop.service.launcher.IrqHandler
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/service/launcher/IrqHandler.java:[126,22] cannot find symbol
[ERROR]   symbol:   class Signal
[ERROR]   location: class org.apache.hadoop.service.launcher.IrqHandler
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/nativeio/NativeIO.java:[48,16] package sun.misc does not exist
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/FastByteComparisons.java:[27,16] package sun.misc does not exist
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/FastByteComparisons.java:[134,20] cannot find symbol
[ERROR]   symbol:   class Unsafe
[ERROR]   location: class org.apache.hadoop.io.FastByteComparisons.LexicographicalComparerHolder.UnsafeComparer
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/SignalLogger.java:[50,39] cannot find symbol
[ERROR]   symbol:   class Signal
[ERROR]   location: class org.apache.hadoop.util.SignalLogger.Handler
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/SignalLogger.java:[50,21] cannot find symbol
[ERROR]   symbol:   variable Signal
[ERROR]   location: class org.apache.hadoop.util.SignalLogger.Handler
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/SignalLogger.java:[58,5] method does not override or implement a method from a supertype
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/service/launcher/IrqHandler.java:[92,20] cannot find symbol
[ERROR]   symbol:   class Signal
[ERROR]   location: class org.apache.hadoop.service.launcher.IrqHandler
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/service/launcher/IrqHandler.java:[93,7] cannot find symbol
[ERROR]   symbol:   variable Signal
[ERROR]   location: class org.apache.hadoop.service.launcher.IrqHandler
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/service/launcher/IrqHandler.java:[113,5] cannot find symbol
[ERROR]   symbol:   variable Signal
[ERROR]   location: class org.apache.hadoop.service.launcher.IrqHandler
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/service/launcher/IrqHandler.java:[125,3] method does not override or implement a method from a supertype
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/nativeio/NativeIO.java:[901,17] cannot find symbol
[ERROR]   symbol:   class Unsafe
[ERROR]   location: class org.apache.hadoop.io.nativeio.NativeIO
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/nativeio/NativeIO.java:[903,7] cannot find symbol
[ERROR]   symbol:   class Unsafe
[ERROR]   location: class org.apache.hadoop.io.nativeio.NativeIO
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/nativeio/NativeIO.java:[903,24] cannot find symbol
[ERROR]   symbol:   class Unsafe
[ERROR]   location: class org.apache.hadoop.io.nativeio.NativeIO
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/FastByteComparisons.java:[140,22] cannot find symbol
[ERROR]   symbol:   class Unsafe
[ERROR]   location: class org.apache.hadoop.io.FastByteComparisons.LexicographicalComparerHolder.UnsafeComparer
[ERROR] /hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/FastByteComparisons.java:[145,29] cannot find symbol
[ERROR]   symbol: class Unsafe
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :hadoop-common
{code}
related jira: https://issues.apache.org/jira/browse/HADOOP-19298