[ 
https://issues.apache.org/jira/browse/HADOOP-18958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17781593#comment-17781593
 ] 

ASF GitHub Bot commented on HADOOP-18958:
-----------------------------------------

xinglin commented on code in PR #6234:
URL: https://github.com/apache/hadoop/pull/6234#discussion_r1378396847


##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java:
##########
@@ -1849,8 +1849,8 @@ protected Subject getSubject() {
   @InterfaceStability.Evolving
   public <T> T doAs(PrivilegedAction<T> action) {
     if (LOG.isDebugEnabled()) {
-      LOG.debug("PrivilegedAction [as: {}][action: {}]", this, action,
-          new Exception());
+      LOG.debug("PrivilegedAction [as: {}][action: {}][from: {}]", this, 
action,
+              Thread.currentThread().getStackTrace()[2]);

Review Comment:
   Without your PR, we get the full stack trace. 
   
   ```
   23/10/30 14:31:39 DEBUG security.UserGroupInformation: PrivilegedAction [as: 
hive/kde-offline1.sdns.kscbigdata.cl...@hadoop.com (auth:KERBEROS)][action: 
org.apache.hadoop.mapreduce.Job$10@5217f3d0]
   java.lang.Exception
        at 
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1875)
        at org.apache.hadoop.mapreduce.Job.connect(Job.java:1536)
        at org.apache.hadoop.mapreduce.Job.submit(Job.java:1565)
        at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1589)
        at org.apache.hadoop.mapreduce.SleepJob.run(SleepJob.java:290)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:81)
        at org.apache.hadoop.mapreduce.SleepJob.main(SleepJob.java:196)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.apache.hadoop.util.ProgramDriver$ProgramDescription.invoke(ProgramDriver.java:71)
        at org.apache.hadoop.util.ProgramDriver.run(ProgramDriver.java:144)
        at 
org.apache.hadoop.test.MapredTestDriver.run(MapredTestDriver.java:139)
        at 
org.apache.hadoop.test.MapredTestDriver.main(MapredTestDriver.java:147)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.hadoop.util.RunJar.run(RunJar.java:323)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:236)
   23/10/30 14:31:39 DEBUG mapreduce.Cluster: Trying ClientProtocolProvider : 
org.apache.hadoop.mapred.YarnClientProtocolProvider
   ```
   
   With your PR, we only get to know the immediate parent function. 
   ```
   23/10/30 14:28:35 DEBUG security.UserGroupInformation: PrivilegedAction [as: 
hive/kde-offline1.sdns.kscbigdata.cl...@hadoop.com (auth:KERBEROS)][action: 
org.apache.hadoop.mapreduce.Job$10@5217f3d0][from: 
org.apache.hadoop.mapreduce.Job.connect(Job.java:1536)]
   23/10/30 14:28:35 DEBUG mapreduce.Cluster: Trying ClientProtocolProvider : 
org.apache.hadoop.mapred.YarnClientProtocolProvider
   ```
   
   I agree the output is shorter. But how do we convince ourselves that 
additional call stack is not useful/needed? I do think these could be useful to 
know.





> UserGroupInformation debug log improve
> --------------------------------------
>
>                 Key: HADOOP-18958
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18958
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: common
>    Affects Versions: 3.3.5, 3.3.3, 3.3.4
>            Reporter: wangzhihui
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 3.3.4
>
>         Attachments: 20231029-122825-1.jpeg, 20231029-122825.jpeg, 
> 20231030-143525.jpeg, image-2023-10-29-09-47-56-489.png, 
> image-2023-10-30-14-35-11-161.png
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
>       Using “new Exception( )” to print the call stack of "doAs Method " in 
> the UserGroupInformation class. Using this way will print meaningless 
> Exception information and too many call stacks, This is not conducive to 
> troubleshooting
> *example:*
> !20231029-122825.jpeg|width=991,height=548!
>  
> *improved result* :
>  
> !image-2023-10-29-09-47-56-489.png|width=1099,height=156!
> !20231030-143525.jpeg|width=572,height=674!



--
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

Reply via email to