[ https://issues.apache.org/jira/browse/HADOOP-19574?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18016793#comment-18016793 ]
ASF GitHub Bot commented on HADOOP-19574: ----------------------------------------- stoty commented on code in PR #7892: URL: https://github.com/apache/hadoop/pull/7892#discussion_r2307456822 ########## hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/concurrent/HadoopThread.java: ########## @@ -0,0 +1,105 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.util.concurrent; + +import java.security.PrivilegedAction; +import javax.security.auth.Subject; + +import org.apache.hadoop.security.authentication.util.SubjectUtil; + +/** + * Helper class to restore Subject propagation behavior after the JEP411/JEP486 + * changes + * + * Runnables can be specified normally, but the work() method has to be + * overridden instead of run() when subclassing. + */ +public class HadoopThread extends Thread { Review Comment: 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. > Restore Subject propagation semantics for Java 22+ > -------------------------------------------------- > > Key: HADOOP-19574 > URL: https://issues.apache.org/jira/browse/HADOOP-19574 > Project: Hadoop Common > Issue Type: Bug > Reporter: Istvan Toth > Assignee: Istvan Toth > Priority: Critical > Labels: pull-request-available > > Java 22 breaks Subject propagation for new Threads (when SecurityManager is > not enabled). > Previously, the Subject set by Subject.doAs() / Subject.callAs() > automatically propagated to any new Threads created (via new Thread(), not > Executors). > With JDK22, this is no longer the case, new Threads do NOT inherit the > Subject. > As Hadoop heavily relies on the original behavior, we somehow need to solve > this problem. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org