You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "mark-bathori (via GitHub)" <gi...@apache.org> on 2024/09/23 20:09:23 UTC

[PR] NIFI-13722: Kerberos ticket renewal issue due static thread pool in Iceberg library (nifi-1.x) [nifi]

mark-bathori opened a new pull request, #9305:
URL: https://github.com/apache/nifi/pull/9305

   <!-- 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. -->
   
   # Summary
   
   [NIFI-13722](https://issues.apache.org/jira/browse/NIFI-13722)
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [ ] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue created
   
   ### Pull Request Tracking
   
   - [ ] Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-00000`
   - [ ] Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-00000`
   
   ### Pull Request Formatting
   
   - [ ] Pull Request based on current revision of the `main` branch
   - [ ] Pull Request refers to a feature branch with one commit containing changes
   
   # Verification
   
   Please indicate the verification steps performed prior to pull request creation.
   
   ### Build
   
   - [ ] Build completed using `mvn clean install -P contrib-check`
     - [ ] JDK 21
   
   ### Licensing
   
   - [ ] New dependencies are compatible with the [Apache License 2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License Policy](https://www.apache.org/legal/resolved.html)
   - [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE` files
   
   ### Documentation
   
   - [ ] Documentation formatting appears as expected in rendered files
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-13722: Kerberos ticket renewal issue due static thread pool in Iceberg library (nifi-1.x) [nifi]

Posted by "dan-s1 (via GitHub)" <gi...@apache.org>.
dan-s1 commented on code in PR #9305:
URL: https://github.com/apache/nifi/pull/9305#discussion_r1772056032


##########
nifi-nar-bundles/nifi-iceberg-bundle/nifi-iceberg-common/src/main/java/org/apache/nifi/processors/iceberg/AbstractIcebergProcessor.java:
##########
@@ -68,35 +70,34 @@ public abstract class AbstractIcebergProcessor extends AbstractProcessor impleme
             .description("A FlowFile is routed to this relationship if the operation failed and retrying the operation will also fail, such as an invalid data or schema.")
             .build();
 
-    protected final AtomicReference<KerberosUser> kerberosUserReference = new AtomicReference<>();
+    protected static final AtomicReference<KerberosUser> kerberosUserReference = new AtomicReference<>();
     protected final AtomicReference<UserGroupInformation> ugiReference = new AtomicReference<>();
 
     @OnScheduled
     public void onScheduled(final ProcessContext context) {
         initKerberosCredentials(context);
     }
 
-    protected void initKerberosCredentials(ProcessContext context) {
+    protected synchronized void initKerberosCredentials(ProcessContext context) {
         final KerberosUserService kerberosUserService = context.getProperty(KERBEROS_USER_SERVICE).asControllerService(KerberosUserService.class);
         final IcebergCatalogService catalogService = context.getProperty(CATALOG).asControllerService(IcebergCatalogService.class);
 
         if (kerberosUserService != null) {
-            final KerberosUser kerberosUser = kerberosUserService.createKerberosUser();
-            kerberosUserReference.set(kerberosUser);
+            KerberosUser kerberosUser;
+            if (kerberosUserReference.get() == null) {
+                kerberosUser = kerberosUserService.createKerberosUser();
+            } else {
+                kerberosUser = kerberosUserReference.get();
+            }

Review Comment:
   Just call `get()` once
   ```suggestion
               KerberosUser kerberosUser = kerberosUserReference.get() ;
               if (kerberosUser == null) {
                   kerberosUser = kerberosUserService.createKerberosUser();
               } 
   ```



##########
nifi-nar-bundles/nifi-iceberg-bundle/nifi-iceberg-common/src/main/java/org/apache/nifi/processors/iceberg/AbstractIcebergProcessor.java:
##########
@@ -115,18 +116,26 @@ public void onTrigger(ProcessContext context, ProcessSession session) throws Pro
                 });
 
             } catch (Exception e) {
-                getLogger().error("Privileged action failed with kerberos user " + kerberosUser, e);
-                session.transfer(session.penalize(flowFile), REL_FAILURE);
+                if (!handleAuthErrors(e, session, context)) {
+                    getLogger().error("Privileged action failed with kerberos user " + kerberosUser, e);

Review Comment:
   Use interpolation and not concatenation.
   ```suggestion
                       getLogger().error("Privileged action failed with kerberos user {}" , kerberosUser, e);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-13722: Kerberos ticket renewal issue due static thread pool in Iceberg library (nifi-1.x) [nifi]

Posted by "mark-bathori (via GitHub)" <gi...@apache.org>.
mark-bathori commented on PR #9305:
URL: https://github.com/apache/nifi/pull/9305#issuecomment-2370404507

   Thanks @dan-s1 for the comments. This is a backport PR so these changes are already merged into the main branch. To keep the consistency between the two branch and PRs I would keep the changes as it is, but your requested changes could be done in a separate PR if necessary.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-13722: Kerberos ticket renewal issue due static thread pool in Iceberg library (nifi-1.x) [nifi]

Posted by "turcsanyip (via GitHub)" <gi...@apache.org>.
turcsanyip commented on PR #9305:
URL: https://github.com/apache/nifi/pull/9305#issuecomment-2371084405

   Merged.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-13722: Kerberos ticket renewal issue due static thread pool in Iceberg library (nifi-1.x) [nifi]

Posted by "turcsanyip (via GitHub)" <gi...@apache.org>.
turcsanyip closed pull request #9305: NIFI-13722: Kerberos ticket renewal issue due static thread pool in Iceberg library (nifi-1.x)
URL: https://github.com/apache/nifi/pull/9305


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org