Skip to content

HADOOP-18138. UserGroupInformation shouldn't log exception unnecessarily #4007

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

sunchao
Copy link
Member

@sunchao sunchao commented Feb 21, 2022

Description of PR

In UserGroupInformation.doAs, we currently create a new Exception and log it in LOG.debug. This doesn't look necessary:

      if (LOG.isDebugEnabled()) {
        LOG.debug("PrivilegedAction [as: {}][action: {}]", this, action,
            new Exception());
      }

How was this patch tested?

Existing tests.

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?

@sunchao sunchao changed the title HADOOP-18138. UserGroupInformation shouldn't log exception HADOOP-18138. UserGroupInformation shouldn't log exception unnecessarily Feb 21, 2022
@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 56s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
-1 ❌ test4tests 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
_ trunk Compile Tests _
+1 💚 mvninstall 34m 51s trunk passed
+1 💚 compile 24m 9s trunk passed with JDK Ubuntu-11.0.13+8-Ubuntu-0ubuntu1.20.04
+1 💚 compile 20m 42s trunk passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚 checkstyle 0m 59s trunk passed
+1 💚 mvnsite 1m 36s trunk passed
+1 💚 javadoc 1m 7s trunk passed with JDK Ubuntu-11.0.13+8-Ubuntu-0ubuntu1.20.04
+1 💚 javadoc 1m 38s trunk passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚 spotbugs 2m 31s trunk passed
+1 💚 shadedclient 25m 1s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 1m 2s the patch passed
+1 💚 compile 23m 31s the patch passed with JDK Ubuntu-11.0.13+8-Ubuntu-0ubuntu1.20.04
+1 💚 javac 23m 31s the patch passed
+1 💚 compile 20m 50s the patch passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚 javac 20m 50s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 1m 2s the patch passed
+1 💚 mvnsite 1m 36s the patch passed
+1 💚 javadoc 1m 5s the patch passed with JDK Ubuntu-11.0.13+8-Ubuntu-0ubuntu1.20.04
+1 💚 javadoc 1m 40s the patch passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚 spotbugs 2m 39s the patch passed
+1 💚 shadedclient 25m 28s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 28m 16s hadoop-common in the patch passed.
+1 💚 asflicense 0m 49s The patch does not generate ASF License warnings.
221m 11s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4007/1/artifact/out/Dockerfile
GITHUB PR #4007
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell
uname Linux c939e816438f 4.15.0-153-generic #160-Ubuntu SMP Thu Jul 29 06:54:29 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / c463cd0
Default Java Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.13+8-Ubuntu-0ubuntu1.20.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4007/1/testReport/
Max. process+thread count 1667 (vs. ulimit of 5500)
modules C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4007/1/console
versions git=2.25.1 maven=3.6.3 spotbugs=4.2.2
Powered by Apache Yetus 0.14.0-SNAPSHOT https://yetus.apache.org

This message was automatically generated.

Copy link
Contributor

@jojochuang jojochuang left a comment

Choose a reason for hiding this comment

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

I thought it was intentional, to log the stack trace of where it was being called?

@sunchao
Copy link
Member Author

sunchao commented Feb 22, 2022

I see. Didn't know the context. It's a bit confusing to see the stack trace like this though:

PrivilegedAction [as: <principal> (auth:KERBEROS)][action: org.apache.hadoop.ipc.Client$Connection$2@65fa2f2d]
java.lang.Exception: null
	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1875) ~[hadoop-client-api-3.3.1.jar:?]
	at org.apache.hadoop.ipc.Client$Connection.setupIOstreams(Client.java:838) ~[hadoop-client-api-3.3.1.jar:?]
	at org.apache.hadoop.ipc.Client$Connection.access$3800(Client.java:414) ~[hadoop-client-api-3.3.1.jar:?]
	at org.apache.hadoop.ipc.Client.getConnection(Client.java:1654) ~[hadoop-client-api-3.3.1.jar:?]
	at org.apache.hadoop.ipc.Client.call(Client.java:1479) ~[hadoop-client-api-3.3.1.jar:?]
	at org.apache.hadoop.ipc.Client.call(Client.java:1432) ~[hadoop-client-api-3.3.1.jar:?]
	at org.apache.hadoop.ipc.ProtobufRpcEngine2$Invoker.invoke(ProtobufRpcEngine2.java:242) ~[hadoop-client-api-3.3.1.jar:?]
	at org.apache.hadoop.ipc.ProtobufRpcEngine2$Invoker.invoke(ProtobufRpcEngine2.java:129) ~[hadoop-client-api-3.3.1.jar:?]
	at com.sun.proxy.$Proxy14.delete(Unknown Source) ~[?:?]

and it could makes people think there's something wrong in the doAs method. Maybe we can strip the first line of the stacktrace and replace with something like:

PrivilegedAction [as: <principal> (auth:KERBEROS)][action: org.apache.hadoop.ipc.Client$Connection$2@65fa2f2d]
Call stacktrace:
	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1875) ~[hadoop-client-api-3.3.1.jar:?]

@busbey
Copy link
Contributor

busbey commented Feb 22, 2022

I'm wary of things that require us to reimplement the logging system handling the stack trace details. Maybe we could convey the purpose in either the exception message or the exception type instead?

e.g.

      if (LOG.isDebugEnabled()) {
        LOG.debug("PrivilegedAction [as: {}][action: {}]", this, action,
            new JustForDebuggingException("call stack for privileged action; not an indication of a failure"));
      }

@sunchao sunchao closed this May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants