Skip to content

Conversation

stoty
Copy link
Contributor

@stoty stoty commented Aug 22, 2025

Description of PR

HADOOP-19574. Restore Subject propagation semantics for Java 22+.

JDK 22 breaks subject propagation into new Threads.
This patch adds a new HadoopThread class which restores the pre JDK22 semantics, and replaces
most Thread objects in the code with HadoopThread.
The Daemon class is silimarly changed.

This is the -hopefully- final patch for full Java 24/25 support.

I went with the approach of replacing almost all Thread objects with HadoopThread, as most of the tests do not set any specific Principal, and it would be had to determine for every Thread usage whether Subject propagation is required for that instance.

While the patch is huge, 99% of it is just mechanically replacing Thread with HadoopThread, and the run() method with the work() method.
There are a few tests which check specific stack traces, which also needed updating.

I'm open to renaming anything if someone can come up with better names.

How was this patch tested?

./start-build-env.sh
export JAVA_HOME=/usr/lib/jvm/temurin-24-jdk-amd64/
mvn clean test -fn 

There are a few failing tests, but those are either flakey or also fail on trunk and / or with Java 8 / 17.

For code changes:

  • Does the title or this PR starts with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')?
  • Object storage: have the integration tests been executed and the endpoint declared according to the connector-specific documentation?
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE, LICENSE-binary, NOTICE-binary files?

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 0s Docker mode activated.
-1 ❌ patch 0m 21s #7892 does not apply to trunk. Rebase required? Wrong Branch? See https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute for help.
Subsystem Report/Notes
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7892/1/console
versions git=2.34.1
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 0s Docker mode activated.
-1 ❌ patch 0m 22s #7892 does not apply to trunk. Rebase required? Wrong Branch? See https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute for help.
Subsystem Report/Notes
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7892/2/console
versions git=2.34.1
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 0s Docker mode activated.
-1 ❌ patch 0m 21s #7892 does not apply to trunk. Rebase required? Wrong Branch? See https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute for help.
Subsystem Report/Notes
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7892/3/console
versions git=2.34.1
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 0s Docker mode activated.
-1 ❌ patch 0m 21s #7892 does not apply to trunk. Rebase required? Wrong Branch? See https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute for help.
Subsystem Report/Notes
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7892/4/console
versions git=2.34.1
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 0s Docker mode activated.
-1 ❌ patch 0m 21s #7892 does not apply to trunk. Rebase required? Wrong Branch? See https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute for help.
Subsystem Report/Notes
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7892/5/console
versions git=2.34.1
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 0s Docker mode activated.
-1 ❌ patch 0m 21s #7892 does not apply to trunk. Rebase required? Wrong Branch? See https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute for help.
Subsystem Report/Notes
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7892/6/console
versions git=2.34.1
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 0s Docker mode activated.
-1 ❌ patch 0m 21s #7892 does not apply to trunk. Rebase required? Wrong Branch? See https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute for help.
Subsystem Report/Notes
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7892/7/console
versions git=2.34.1
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 0s Docker mode activated.
-1 ❌ patch 0m 32s #7892 does not apply to trunk. Rebase required? Wrong Branch? See https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute for help.
Subsystem Report/Notes
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7892/8/console
versions git=2.34.1
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@stoty stoty marked this pull request as ready for review August 27, 2025 12:11
@stoty
Copy link
Contributor Author

stoty commented Aug 27, 2025

This is final piece for Java 24 / 25 support.
While the patch is huge, the actual changes are very simple.
HadoopThread was added and Daemon was modified, the rest is just simply replacement.

Please take a look @pan3793 @slfan1989 @jojochuang @cnauroth @steveloughran

@slfan1989
Copy link
Contributor

This is final piece for Java 24 / 25 support. While the patch is huge, the actual changes are very simple. HadoopThread was added and Daemon was modified, the rest is just simply replacement.

Please take a look @pan3793 @slfan1989 @jojochuang @cnauroth @steveloughran

I have a few experienced members to recommend for the review.

@Hexiaoqiao @ayushtkn @szetszwo I need your help to collaboratively review this PR. Thank you very much!

Copy link
Contributor

@cnauroth cnauroth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @stoty . It looks like Yetus is saying this won't apply to trunk. Does it need a rebase? I also just committed MAPREDUCE-7502, so if you rebase, the test fix won't need to be applied manually anymore.

@stoty
Copy link
Contributor Author

stoty commented Aug 27, 2025

Unfortunately Yetus cannot handle patches this big, I don't think we can get CI run via GitHub.

@slfan1989
Copy link
Contributor

@cnauroth @szetszwo Thank you for your responses! Regarding the issue with Yetus failing to compile, @ayushtkn proposed a solution to handle large PRs. I suggest we first run this PR to test it, and if it’s suitable for splitting, we can submit it in parts.

@stoty Thank you for your contribution! Please review the details of this commit. During development, we need to replace Yetus with Ayush's branch. If this PR is merged, we should revert this commit.

8d636ce

@stoty
Copy link
Contributor Author

stoty commented Aug 28, 2025

Unfortunately Yetus cannot handle patches this big, I don't think we can get CI run via GitHub.

@stoty , we usually break such a large change into several JIRAs. In this case, we may

  1. add HadoopThread and change hadoop-common to use it;
  2. change HDFS to use HadoopThread;
  3. change Mapreduce/YARN to use HadoopThread; and
  4. change all the remaining components to use it.

The problem with this is that it would make it impossible to get a clean JDK24/25 test run until all the changes are committed, hence all but the last commit would be flying blind WRT testing.
(It also wouldn't make a lot of sense, as the changes are exactly the same for all subprojects)

Alternatively, we may work on it in a dev branch.

That sounds better, but I personally don't have the permissions for that.
Could you (or someone else ) open a feature branch and add this commit ?

use ayushtkn's Yetus branch
@github-actions github-actions bot added the Infra label Aug 28, 2025
@stoty
Copy link
Contributor Author

stoty commented Aug 28, 2025

Thanks, I've changed the Yetus version.
Let's hope it works.

@slfan1989
Copy link
Contributor

Unfortunately Yetus cannot handle patches this big, I don't think we can get CI run via GitHub.

@stoty , we usually break such a large change into several JIRAs. In this case, we may

  1. add HadoopThread and change hadoop-common to use it;
  2. change HDFS to use HadoopThread;
  3. change Mapreduce/YARN to use HadoopThread; and
  4. change all the remaining components to use it.

The problem with this is that it would make it impossible to get a clean JDK24/25 test run until all the changes are committed, hence all but the last commit would be flying blind WRT testing. (It also wouldn't make a lot of sense, as the changes are exactly the same for all subprojects)

Alternatively, we may work on it in a dev branch.

That sounds better, but I personally don't have the permissions for that. Could you (or someone else ) open a feature branch and add this commit ?

@stoty I support creating a separate dev branch, +1, and I'm willing to help follow up and create the new branch.

@stoty
Copy link
Contributor Author

stoty commented Aug 28, 2025

Thanks @slfan1989 . If the purpose of the new branch would be only getting Yetus work, and the new Yetus branch fixes the issue, then the feature branch may not be necessary.

@slfan1989
Copy link
Contributor

Thanks @slfan1989 . If the purpose of the new branch would be only getting Yetus work, and the new Yetus branch fixes the issue, then the feature branch may not be necessary.

Thank you for your feedback. Let's wait for Yetus's results.

@stoty
Copy link
Contributor Author

stoty commented Aug 28, 2025

For reference, here are my notes on the tests that failed on my JDK24 run:

<style type="text/css"></style>

TestAMSimulator FLAKEY ON TRUNK
TestFederationWebApp FAILS ON TRUNK
TestRouterWebServicesREST. FAILS ON TRUNK
TestYarnFederationWithFairScheduler.setUp ? timeout FLAKEY ON TRUNK
TestUberAM ? FAILS ON TRUNK
TestLogAggregationService ? FAILS ON TRUNK
TestRMHAForAsyncScheduler ? FIXED
TestHdfsNativeCodeLoader.testNativeCodeLoaded:48 TestNativeCodeLoader - Native lib setup Test setup problem
TestDataNodeErasureCodingMetrics.testReconstructionBytesPartialGroup3:153 FLAKEY
TestDirectoryScanner FAILS ON TRUNK
TestFSNamesystemLock.testFSReadLockLongHoldingReport:305 expected: but was: FIXED
TestNameNodeMXBean FAILS ON TRUNK
TestViewFileSystemHdfs.testTrashRootsAfterEncryptionZoneDeletion FAILS ON TRUNK

@Hexiaoqiao
Copy link
Contributor

Thanks @stoty and @slfan1989 for your work. LGTM (with checked in PR #7886). One concerns, Yetus is saying not good to check in. Agree to work on dev branch, then merge to trunk when it is ready. Thanks all again.

@ayushtkn
Copy link
Member

@stoty Yetus does have some issue applying changes when the changes are beyond a certain point. I reported it some time back:
https://issues.apache.org/jira/browse/YETUS-719?focusedCommentId=17874835&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17874835

You can temporarily hack it by c-picking this commit & revert it once you get the result from Yetus:
ayushtkn@bee603e

See, if it helps :-)

@pan3793
Copy link
Member

pan3793 commented Aug 28, 2025

@stoty Most tests can pass in Java 25 even without this PR. Is it possible to have a PR only include changes that fix affected tests?

@stoty
Copy link
Contributor Author

stoty commented Aug 28, 2025

That would take some time @pan3793 .

The problem is that very few of the tests are using Kerberos, and the subject issue mostly breaks Kerberized clusters.

Making only enough changes to fix the tests would probably lead to a lot of real world breakages.

We could remove the "unneccessary" changes from the test code.

I'm not sure if Hadoop has a mechanism to run tests on a real cluster instead of miniclusters. If it does, then many of those changes will be needed for running tests on kerberized real clusters.

I'm going to run the test sute on JDK24 without the patch, and report the breakages here.

@stoty
Copy link
Contributor Author

stoty commented Aug 28, 2025

I general, I think for robustness reasons Hadoop should stop directly using Thread.
I would go as far as adding maven enforcer rules to prohibit code from directly using Thread.

Using a naked Thread by mistake in the code can lead to hard to debug bugs which only manifest in kerberized (i.e real production) clusters.

It is much safer to use HadoopThread everywhere, the overhead is negligible compared to the cost of starting a new thread. (basically reading then setting a ThreadLocal or equivalent structure)

* Runnables can be specified normally, but the work() method has to be
* overridden instead of run() when subclassing.
*/
public class HadoopThread extends Thread {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hadoop has MiniKDC in the test infrastructure, is it possible to have a dedicated UT for HadoopThread, so that we can test against different JDK versions to ensure the consistent semantics of Subject propagation?

and downstream projects that require Subject propagation also need to change their code, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need miniKDC for that, testing for the Subject propagation is trivial. Kerberos need Subject propagation, but we don't Kerberos to test that.

Yes, downstream projects that depend on the original Subject propagation semantics will need also to deal with the changes separately.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So HadoopThread will be a public API used widely by downstream projects, then it needs more detailed javadocs (better to include examples), and a dedicated UT will also be a good example for developers to learn and understand what it does.

I think it's worth a dedicated PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a unit test.

It's really up to downstream projects.

For example, in HBase we support multiple Hadoop versions, so we will have to clone HadoopThread, otherwise we'd have to drop support for all earlier Hadoop versions.

Downstream users who are fine with supporting only the latest Hadoop release can use it directly.

If we consider this a public API, then maybe we could try to find a better name for it, as HadoopThread is not very descriptive, I just haven't been able to find one that is not super long or awkward.

SubjectInheritingThread would be a candidate, but it's too long IMO.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I support naming it SubjectInheritingThread

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed

@stoty
Copy link
Contributor Author

stoty commented Aug 28, 2025

I'm not sure if Hadoop has a mechanism to run tests on a real cluster instead of miniclusters. If it does, then many of those changes will be needed for running tests on kerberized real clusters.

I got confirmation that Hadoop cannot run the test suite on external cluters, so in theory we don't need to replace Thread everywhere in the tests.

I still think that it's more robust to replace every Thread instance.


@Override
public final void run() {
SubjectUtil.doAs(startSubject, new PrivilegedAction<Void>() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: indention is incorrect here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reformatted the class

* Override this instead of run()
*/
public void work() {
throw new IllegalArgumentException("");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have a meaningful message?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the logic to match the the one in Thread.

Subject startSubject;

@Override
public final void start() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indention


@Override
public final void run() {
SubjectUtil.doAs(startSubject, new PrivilegedAction<Void>() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indention

}
};

HadoopThread t = new HadoopThread(r);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add another case that uses Thread? and it should have different behaviors on different JDK versions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@szetszwo szetszwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stoty , thanks for working on this! I suggest to add a Builder; see the inlined comment.

Comment on lines 38 to 70
public HadoopThread() {
super();
}

public HadoopThread(Runnable target) {
super();
this.hadoopTarget = target;
}

public HadoopThread(ThreadGroup group, Runnable target) {
// The target passed to Thread has no effect, we only pass it
// because there is no super(group) constructor.
super(group, target);
this.hadoopTarget = target;
}

public HadoopThread(Runnable target, String name) {
super(name);
this.hadoopTarget = target;
}

public HadoopThread(String name) {
super(name);
}

public HadoopThread(ThreadGroup group, String name) {
super(group, name);
}

public HadoopThread(ThreadGroup group, Runnable target, String name) {
super(group, name);
this.hadoopTarget = target;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should add a Builder class instead of having public constructor. Then, we can make it configurable to return Thread or HadoopThread or something else in the future.

diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/concurrent/HadoopThread.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/concurrent/HadoopThread.java
index 5ce2c75f4f4..fedd4e3a107 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/concurrent/HadoopThread.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/concurrent/HadoopThread.java
@@ -32,6 +32,22 @@
  */
 public class HadoopThread extends Thread {
 
+  public static Builder newBuilder() {
+    return new Builder();
+  }
+
+  public static class Builder {
+    private Runnable runnable;
+
+    public Builder setRunnable(Runnable runnable) {
+      this.runnable = runnable;
+      return this;
+    }
+    public HadoopThread build() {
+      return new HadoopThread(runnable);
+    }
+  }
+
   Subject startSubject;
   Runnable hadoopTarget;
 
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/util/TestByteArrayManager.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/util/TestByteArrayManager.java
index 80d2859684f..35e7b71fd2e 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/util/TestByteArrayManager.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/util/TestByteArrayManager.java
@@ -178,7 +178,9 @@ public void testAllocateRecycle() throws Exception {
         waitForAll(allocator.futures);
 
         // allocate one more should be blocked
-        final AllocatorThread t = new AllocatorThread(arrayLength, bam);
+        final Thread t = HadoopThread.newBuilder()
+            .setRunnable(() -> new AllocatorMethod().run(arrayLength, bam))
+            .build();
         t.start();
         
         // check if the thread is waiting, timed wait or runnable.
@@ -227,18 +229,10 @@ static <T> void waitForAll(List<Future<T>> furtures) throws Exception {
     }
   }
 
-  static class AllocatorThread extends HadoopThread {
-    private final ByteArrayManager bam;
-    private final int arrayLength;
+  static class AllocatorMethod {
     private byte[] array;
     
-    AllocatorThread(int arrayLength, ByteArrayManager bam) {
-      this.bam = bam;
-      this.arrayLength = arrayLength;
-    }
-
-    @Override
-    public void work() {
+    void run(int arrayLength, ByteArrayManager bam) {
       try {
         array = bam.newByteArray(arrayLength);
       } catch (InterruptedException e) {
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsVolumeList.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsVolumeList.java
index a9ecdd46bcb..8b4883beb96 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsVolumeList.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsVolumeList.java
@@ -508,8 +508,7 @@ void addBlockPool(final String bpid, final Configuration conf) throws IOExceptio
         new ConcurrentHashMap<FsVolumeSpi, IOException>();
     List<Thread> blockPoolAddingThreads = new ArrayList<Thread>();
     for (final FsVolumeImpl v : volumes) {
-      Thread t = new HadoopThread() {
-        public void work() {
+      final Thread t = HadoopThread.newBuilder().setRunnable(() -> {
           try (FsVolumeReference ref = v.obtainReference()) {
             FsDatasetImpl.LOG.info("Scanning block pool " + bpid +
                 " on volume " + v + "...");
@@ -523,8 +522,7 @@ public void work() {
                 ". Will throw later.", ioe);
             unhealthyDataDirs.put(v, ioe);
           }
-        }
-      };
+      }).build();
       blockPoolAddingThreads.add(t);
       t.start();
     }

Copy link
Contributor Author

@stoty stoty Aug 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO that's out of scope for this ticket, @szetszwo .

The current HadoopThread (now renamed to SubjectInheritingThread) intentionally follows the Thread syntax as close as possible for minimum changes in the callers.

Adding a Builder and rewriting everything to use that in this patch would increase the patch size and would be error-prone IMO, while it wouldn't add anything to the Java 25 compatibility.

I think that both a ThreadBuilder (in a separate class to avoid conflicts with the JDK21 native Thread.Builder) and rewriting the run()/work() overriding threads to use Runnables are good improvments, but they should be handled in a separate JIRA (or maybe even two separate JIRAs).

@pan3793
Copy link
Member

pan3793 commented Aug 29, 2025

The change LGTM. @stoty thank you for such great works!

The current diff is huge, my only suggestion is to extract the SubjectInheritingThread, Daemon, and related test suites to a dedicated PR after you complete the integration tests. This also benefits future explorers of the Hadoop codebase, I have had many bad experiences in finding the essential changes in a large patch.

@stoty stoty mentioned this pull request Aug 29, 2025
4 tasks
@stoty
Copy link
Contributor Author

stoty commented Aug 29, 2025

#7919 is the split PR @pan3793

* Hadoop security heavily relies on the original behavior, as Subject is at the
* core of JAAS. This class wraps thread. It overrides start() and saves the
* Subject of the current thread, and wraps the payload in a
* Subject.doAs()/callAs() call to restorere it in the newly created Thread.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: should be 'restore'

}

/**
* Behaves similar to {@link Thread#Thread(ThreadGroup, Runnable)} constructor.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

Fixed both on #7919

Let's continue reviewing there.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 35s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 6s No case conflicting files found.
+0 🆗 codespell 0m 6s codespell was not available.
+0 🆗 detsecrets 0m 6s detect-secrets was not available.
+0 🆗 shelldocs 0m 6s Shelldocs was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 191 new or modified test files.
_ trunk Compile Tests _
+0 🆗 mvndep 9m 35s Maven dependency ordering for branch
+1 💚 mvninstall 32m 44s trunk passed
+1 💚 compile 15m 45s trunk passed with JDK Ubuntu-11.0.27+6-post-Ubuntu-0ubuntu120.04
+1 💚 compile 13m 51s trunk passed with JDK Private Build-1.8.0_452-8u452-gaus1-0ubuntu120.04-b09
+1 💚 checkstyle 5m 6s trunk passed
+1 💚 mvnsite 33m 15s trunk passed
+1 💚 javadoc 28m 8s trunk passed with JDK Ubuntu-11.0.27+6-post-Ubuntu-0ubuntu120.04
+1 💚 javadoc 28m 18s trunk passed with JDK Private Build-1.8.0_452-8u452-gaus1-0ubuntu120.04-b09
+1 💚 spotbugs 47m 20s trunk passed
+1 💚 shadedclient 37m 50s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 34s Maven dependency ordering for patch
+1 💚 mvninstall 18m 40s the patch passed
+1 💚 compile 15m 10s the patch passed with JDK Ubuntu-11.0.27+6-post-Ubuntu-0ubuntu120.04
+1 💚 javac 15m 10s the patch passed
+1 💚 compile 13m 55s the patch passed with JDK Private Build-1.8.0_452-8u452-gaus1-0ubuntu120.04-b09
+1 💚 javac 13m 55s the patch passed
-1 ❌ blanks 0m 0s /blanks-eol.txt The patch has 17 line(s) that end in blanks. Use git apply --whitespace=fix <<patch_file>>. Refer https://git-scm.com/docs/git-apply
-0 ⚠️ checkstyle 5m 1s /results-checkstyle-root.txt root: The patch generated 27 new + 6335 unchanged - 17 fixed = 6362 total (was 6352)
+1 💚 mvnsite 33m 0s the patch passed
+1 💚 shellcheck 0m 1s No new issues.
+1 💚 javadoc 30m 3s the patch passed with JDK Ubuntu-11.0.27+6-post-Ubuntu-0ubuntu120.04
+1 💚 javadoc 28m 35s the patch passed with JDK Private Build-1.8.0_452-8u452-gaus1-0ubuntu120.04-b09
+1 💚 spotbugs 55m 2s the patch passed
+1 💚 shadedclient 36m 17s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 23m 35s hadoop-common in the patch passed.
+1 💚 unit 3m 57s hadoop-kms in the patch passed.
+1 💚 unit 1m 37s hadoop-registry in the patch passed.
+1 💚 unit 3m 2s hadoop-hdfs-client in the patch passed.
+1 💚 unit 178m 14s hadoop-hdfs in the patch passed.
+1 💚 unit 3m 59s hadoop-hdfs-nfs in the patch passed.
+1 💚 unit 6m 15s hadoop-yarn-common in the patch passed.
+1 💚 unit 5m 0s hadoop-yarn-server-common in the patch passed.
+1 💚 unit 4m 29s hadoop-yarn-server-applicationhistoryservice in the patch passed.
-1 ❌ unit 115m 7s /patch-unit-hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-resourcemanager.txt hadoop-yarn-server-resourcemanager in the patch failed.
+1 💚 unit 27m 31s hadoop-yarn-server-nodemanager in the patch passed.
+1 💚 unit 29m 33s hadoop-yarn-client in the patch passed.
+1 💚 unit 9m 40s hadoop-mapreduce-client-core in the patch passed.
+1 💚 unit 1m 40s hadoop-mapreduce-client-common in the patch passed.
+1 💚 unit 9m 26s hadoop-mapreduce-client-app in the patch passed.
+1 💚 unit 4m 45s hadoop-mapreduce-client-hs in the patch passed.
-1 ❌ unit 105m 56s /patch-unit-hadoop-mapreduce-project_hadoop-mapreduce-client_hadoop-mapreduce-client-jobclient.txt hadoop-mapreduce-client-jobclient in the patch passed.
+1 💚 unit 38m 39s hadoop-distcp in the patch passed.
+1 💚 unit 2m 55s hadoop-federation-balance in the patch passed.
+1 💚 unit 47m 45s hadoop-hdfs-rbf in the patch passed.
-1 ❌ unit 15m 30s /patch-unit-hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-router.txt hadoop-yarn-server-router in the patch passed.
+1 💚 unit 1m 16s hadoop-yarn-server-timelineservice-documentstore in the patch passed.
+1 💚 unit 22m 50s hadoop-yarn-applications-distributedshell in the patch passed.
+1 💚 unit 1m 19s hadoop-yarn-applications-unmanaged-am-launcher in the patch passed.
+1 💚 unit 21m 7s hadoop-yarn-services-core in the patch passed.
+1 💚 unit 2m 43s hadoop-yarn-services-api in the patch passed.
+1 💚 unit 11m 2s hadoop-mapreduce-client-nativetask in the patch passed.
+1 💚 unit 1m 23s hadoop-mapreduce-examples in the patch passed.
+1 💚 unit 7m 33s hadoop-streaming in the patch passed.
+1 💚 unit 1m 37s hadoop-dynamometer-workload in the patch passed.
+1 💚 unit 1m 4s hadoop-dynamometer-infra in the patch passed.
+1 💚 unit 16m 17s hadoop-gridmix in the patch passed.
+1 💚 unit 4m 1s hadoop-aws in the patch passed.
+1 💚 unit 3m 36s hadoop-azure in the patch passed.
+1 💚 unit 1m 20s hadoop-resourceestimator in the patch passed.
+1 💚 unit 5m 44s hadoop-compat-bench in the patch passed.
+1 💚 asflicense 1m 25s The patch does not generate ASF License warnings.
1244m 47s
Reason Tests
Failed junit tests hadoop.mapreduce.v2.TestUberAM
hadoop.yarn.server.router.webapp.TestFederationWebApp
hadoop.yarn.server.router.subcluster.fair.TestYarnFederationWithFairScheduler
hadoop.yarn.server.router.webapp.TestRouterWebServicesREST
Subsystem Report/Notes
Docker ClientAPI=1.51 ServerAPI=1.51 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7892/11/artifact/out/Dockerfile
GITHUB PR #7892
Optional Tests dupname asflicense codespell detsecrets shellcheck shelldocs compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle
uname Linux a4ee96e34014 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / f6343ab
Default Java Private Build-1.8.0_452-8u452-gaus1-0ubuntu120.04-b09
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.27+6-post-Ubuntu-0ubuntu120.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_452-8u452-gaus1-0ubuntu120.04-b09
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7892/11/testReport/
Max. process+thread count 3807 (vs. ulimit of 5500)
modules C: hadoop-common-project/hadoop-common hadoop-common-project/hadoop-kms hadoop-common-project/hadoop-registry hadoop-hdfs-project/hadoop-hdfs-client hadoop-hdfs-project/hadoop-hdfs hadoop-hdfs-project/hadoop-hdfs-nfs hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient hadoop-tools/hadoop-distcp hadoop-tools/hadoop-federation-balance hadoop-hdfs-project/hadoop-hdfs-rbf hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-documentstore hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-api hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask hadoop-mapreduce-project/hadoop-mapreduce-examples hadoop-tools/hadoop-streaming hadoop-tools/hadoop-dynamometer/hadoop-dynamometer-workload hadoop-tools/hadoop-dynamometer/hadoop-dynamometer-infra hadoop-tools/hadoop-gridmix hadoop-tools/hadoop-aws hadoop-tools/hadoop-azure hadoop-tools/hadoop-resourceestimator hadoop-tools/hadoop-compat-bench U: .
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7892/11/console
versions git=2.25.1 maven=3.6.3 spotbugs=4.2.2 shellcheck=0.7.0
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

@stoty
Copy link
Contributor Author

stoty commented Aug 29, 2025

Conflict fixed on #7919

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 57s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 6s No case conflicting files found.
+0 🆗 codespell 0m 6s codespell was not available.
+0 🆗 detsecrets 0m 6s detect-secrets was not available.
+0 🆗 shelldocs 0m 6s Shelldocs was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 191 new or modified test files.
_ trunk Compile Tests _
+0 🆗 mvndep 9m 45s Maven dependency ordering for branch
+1 💚 mvninstall 38m 59s trunk passed
+1 💚 compile 18m 26s trunk passed with JDK Ubuntu-11.0.27+6-post-Ubuntu-0ubuntu120.04
+1 💚 compile 16m 20s trunk passed with JDK Private Build-1.8.0_452-8u452-gaus1-0ubuntu120.04-b09
+1 💚 checkstyle 6m 37s trunk passed
+1 💚 mvnsite 31m 8s trunk passed
+1 💚 javadoc 27m 26s trunk passed with JDK Ubuntu-11.0.27+6-post-Ubuntu-0ubuntu120.04
+1 💚 javadoc 25m 53s trunk passed with JDK Private Build-1.8.0_452-8u452-gaus1-0ubuntu120.04-b09
+1 💚 spotbugs 47m 56s trunk passed
+1 💚 shadedclient 44m 8s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 32s Maven dependency ordering for patch
+1 💚 mvninstall 17m 37s the patch passed
+1 💚 compile 18m 18s the patch passed with JDK Ubuntu-11.0.27+6-post-Ubuntu-0ubuntu120.04
+1 💚 javac 18m 18s the patch passed
+1 💚 compile 17m 9s the patch passed with JDK Private Build-1.8.0_452-8u452-gaus1-0ubuntu120.04-b09
+1 💚 javac 17m 9s the patch passed
-1 ❌ blanks 0m 0s /blanks-eol.txt The patch has 11 line(s) that end in blanks. Use git apply --whitespace=fix <<patch_file>>. Refer https://git-scm.com/docs/git-apply
-0 ⚠️ checkstyle 6m 11s /results-checkstyle-root.txt root: The patch generated 25 new + 6333 unchanged - 17 fixed = 6358 total (was 6350)
+1 💚 mvnsite 31m 1s the patch passed
+1 💚 shellcheck 0m 0s No new issues.
-1 ❌ javadoc 1m 14s /results-javadoc-javadoc-hadoop-common-project_hadoop-common-jdkUbuntu-11.0.27+6-post-Ubuntu-0ubuntu120.04.txt hadoop-common-project_hadoop-common-jdkUbuntu-11.0.27+6-post-Ubuntu-0ubuntu120.04 with JDK Ubuntu-11.0.27+6-post-Ubuntu-0ubuntu120.04 generated 11 new + 0 unchanged - 0 fixed = 11 total (was 0)
+1 💚 javadoc 25m 21s the patch passed with JDK Private Build-1.8.0_452-8u452-gaus1-0ubuntu120.04-b09
+1 💚 spotbugs 56m 12s the patch passed
+1 💚 shadedclient 43m 38s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 23m 17s hadoop-common in the patch passed.
+1 💚 unit 3m 50s hadoop-kms in the patch passed.
+1 💚 unit 1m 36s hadoop-registry in the patch passed.
+1 💚 unit 2m 56s hadoop-hdfs-client in the patch passed.
+1 💚 unit 221m 10s hadoop-hdfs in the patch passed.
+1 💚 unit 4m 28s hadoop-hdfs-nfs in the patch passed.
+1 💚 unit 6m 23s hadoop-yarn-common in the patch passed.
+1 💚 unit 5m 23s hadoop-yarn-server-common in the patch passed.
+1 💚 unit 4m 57s hadoop-yarn-server-applicationhistoryservice in the patch passed.
-1 ❌ unit 120m 39s /patch-unit-hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-resourcemanager.txt hadoop-yarn-server-resourcemanager in the patch failed.
+1 💚 unit 28m 11s hadoop-yarn-server-nodemanager in the patch passed.
+1 💚 unit 29m 50s hadoop-yarn-client in the patch passed.
+1 💚 unit 9m 28s hadoop-mapreduce-client-core in the patch passed.
+1 💚 unit 1m 31s hadoop-mapreduce-client-common in the patch passed.
+1 💚 unit 9m 11s hadoop-mapreduce-client-app in the patch passed.
+1 💚 unit 4m 35s hadoop-mapreduce-client-hs in the patch passed.
-1 ❌ unit 105m 14s /patch-unit-hadoop-mapreduce-project_hadoop-mapreduce-client_hadoop-mapreduce-client-jobclient.txt hadoop-mapreduce-client-jobclient in the patch passed.
+1 💚 unit 37m 14s hadoop-distcp in the patch passed.
+1 💚 unit 3m 15s hadoop-federation-balance in the patch passed.
-1 ❌ unit 51m 8s /patch-unit-hadoop-hdfs-project_hadoop-hdfs-rbf.txt hadoop-hdfs-rbf in the patch passed.
-1 ❌ unit 15m 37s /patch-unit-hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-router.txt hadoop-yarn-server-router in the patch passed.
+1 💚 unit 1m 27s hadoop-yarn-server-timelineservice-documentstore in the patch passed.
+1 💚 unit 22m 50s hadoop-yarn-applications-distributedshell in the patch passed.
+1 💚 unit 1m 30s hadoop-yarn-applications-unmanaged-am-launcher in the patch passed.
+1 💚 unit 21m 32s hadoop-yarn-services-core in the patch passed.
+1 💚 unit 2m 48s hadoop-yarn-services-api in the patch passed.
+1 💚 unit 11m 35s hadoop-mapreduce-client-nativetask in the patch passed.
+1 💚 unit 1m 27s hadoop-mapreduce-examples in the patch passed.
+1 💚 unit 7m 43s hadoop-streaming in the patch passed.
+1 💚 unit 1m 43s hadoop-dynamometer-workload in the patch passed.
+1 💚 unit 1m 8s hadoop-dynamometer-infra in the patch passed.
+1 💚 unit 16m 54s hadoop-gridmix in the patch passed.
+1 💚 unit 4m 2s hadoop-aws in the patch passed.
+1 💚 unit 3m 48s hadoop-azure in the patch passed.
+1 💚 unit 1m 25s hadoop-resourceestimator in the patch passed.
+1 💚 unit 5m 40s hadoop-compat-bench in the patch passed.
+1 💚 asflicense 1m 43s The patch does not generate ASF License warnings.
1322m 29s
Reason Tests
Failed junit tests hadoop.mapreduce.v2.TestUberAM
hadoop.hdfs.server.federation.router.TestRouterRpc
hadoop.yarn.server.router.subcluster.fair.TestYarnFederationWithFairScheduler
Subsystem Report/Notes
Docker ClientAPI=1.51 ServerAPI=1.51 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7892/12/artifact/out/Dockerfile
GITHUB PR #7892
Optional Tests dupname asflicense codespell detsecrets shellcheck shelldocs compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle
uname Linux 9ccc38155578 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 24aefca
Default Java Private Build-1.8.0_452-8u452-gaus1-0ubuntu120.04-b09
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.27+6-post-Ubuntu-0ubuntu120.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_452-8u452-gaus1-0ubuntu120.04-b09
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7892/12/testReport/
Max. process+thread count 3970 (vs. ulimit of 5500)
modules C: hadoop-common-project/hadoop-common hadoop-common-project/hadoop-kms hadoop-common-project/hadoop-registry hadoop-hdfs-project/hadoop-hdfs-client hadoop-hdfs-project/hadoop-hdfs hadoop-hdfs-project/hadoop-hdfs-nfs hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient hadoop-tools/hadoop-distcp hadoop-tools/hadoop-federation-balance hadoop-hdfs-project/hadoop-hdfs-rbf hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-documentstore hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-api hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask hadoop-mapreduce-project/hadoop-mapreduce-examples hadoop-tools/hadoop-streaming hadoop-tools/hadoop-dynamometer/hadoop-dynamometer-workload hadoop-tools/hadoop-dynamometer/hadoop-dynamometer-infra hadoop-tools/hadoop-gridmix hadoop-tools/hadoop-aws hadoop-tools/hadoop-azure hadoop-tools/hadoop-resourceestimator hadoop-tools/hadoop-compat-bench U: .
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7892/12/console
versions git=2.25.1 maven=3.6.3 spotbugs=4.2.2 shellcheck=0.7.0
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

Copy link
Contributor

@szetszwo szetszwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stoty , thanks for the update!

The current HadoopThread (now renamed to SubjectInheritingThread) intentionally follows the Thread syntax as close as possible for minimum changes in the callers.

In this patch, we are changing

  • new Thread(..) -> new SubjectInheritingThread(..)

My suggestion is to change

  • new Thread(..) -> new SubjectInheritingThread.newBuilder()...build()

If we do it in separated JIRAs, we will need to rewrite the almost all code this PR.

*/
@Override
public final void run() {
SubjectUtil.doAs(startSubject, new PrivilegedAction<Void>() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a performance problem in this PR since it makes all the threads calling doAs. For pre-Java 22, it will hurt the performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants