Skip to content

[SPARK-52613][CORE][SQL] Restore printing full stacktrace when HBase/Hive DelegationTokenProvider hit exception #51320

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

pan3793
Copy link
Member

@pan3793 pan3793 commented Jun 30, 2025

What changes were proposed in this pull request?

After SPARK-35747(3.2.0), Spark stops printing full stacktrace when HBase/Hive/Kafka DelegationTokenProvider hit exceptions.

SPARK-35747 actually makes two changes:

  1. Remove full stacktrace from logs
  2. Guide disabling unused DelegationTokenProvider - If $serviceName is not used, set spark.security.credentials.$serviceName.enabled to false

I think 2 is useful, but 1 is incorrect, this PR logically reverts 1 (changes in KafkaDelegationTokenProvider have been reverted in SPARK-47593(4.0.0))

We recently hit an issue related to HBaseDelegationTokenProvider, the printed error message is

[WARN] [main] HBaseDelegationTokenProvider#94 - Failed to get token from service hbase due to java.lang.reflect.InvocationTargetException. If hbase is not used, set spark.security.credentials.hbase.enabled to false. Retrying to fetch HBase security token with hbase connection parameter.

it makes us think it's related to a classpath issue, but eventually, after we changed the code to print the full stacktrace, we found the root cause is

org.apache.hadoop.hbase.security.AccessDeniedException: Insufficient permissions (user=***/***@***.COM, scope=hbase:meta, params=[table=hbase:meta,],action=EXEC)

Full stacktrace: https://gist.github.com/pan3793/46a3f6b956a7982646e1ee75603a1865

Why are the changes needed?

Improve the diagnosis experience.

Does this PR introduce any user-facing change?

Yes, the user would see rich error messages when HBase/Hive DelegationTokenProvider hit exceptions.

How was this patch tested?

Manual test.

Was this patch authored or co-authored using generative AI tooling?

No.

@pan3793
Copy link
Member Author

pan3793 commented Jun 30, 2025

cc @vinodkc (who authored SPARK-35747) @dongjoon-hyun @yaooqinn

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

To @pan3793 , given the posted example, this PR may leak a user information more as a new security vulnerability.

Caused by: org.apache.hadoop.hbase.ipc.RemoteWithExtrasException: org.apache.hadoop.hbase.security.AccessDeniedException: Insufficient permissions (user=bdms_admin.mammut/[email protected], scope=hbase:meta, params=[table=hbase:meta,],action=EXEC)

@pan3793
Copy link
Member Author

pan3793 commented Jun 30, 2025

@dongjoon-hyun thank you for raising concerns. I would argue that the username/principal is relatively insensitive information in such a context, username/principal is also displayed in the Spark UI / Environment page without redaction, and users would see a similar error message when they access Hive databases/tables or HDFS files without permission.

@dongjoon-hyun
Copy link
Member

Got it. It sounds reasonable to me.

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

+1, LGTM (from my side). Thank you always, @pan3793 .

@yaooqinn yaooqinn closed this in e8384d5 Jul 3, 2025
yaooqinn pushed a commit that referenced this pull request Jul 3, 2025
…Hive DelegationTokenProvider hit exception

### What changes were proposed in this pull request?

After SPARK-35747(3.2.0), Spark stops printing full stacktrace when HBase/Hive/Kafka DelegationTokenProvider hit exceptions.

SPARK-35747 actually makes two changes:
1. Remove full stacktrace from logs
2. Guide disabling unused DelegationTokenProvider - `If $serviceName is not used, set spark.security.credentials.$serviceName.enabled to false`

I think 2 is useful, but 1 is incorrect, this PR logically reverts 1 (changes in KafkaDelegationTokenProvider have been reverted in SPARK-47593(4.0.0))

We recently hit an issue related to HBaseDelegationTokenProvider, the printed error message is
```
[WARN] [main] HBaseDelegationTokenProvider#94 - Failed to get token from service hbase due to java.lang.reflect.InvocationTargetException. If hbase is not used, set spark.security.credentials.hbase.enabled to false. Retrying to fetch HBase security token with hbase connection parameter.
```
it makes us think it's related to a classpath issue, but eventually, after we changed the code to print the full stacktrace, we found the root cause is
```
org.apache.hadoop.hbase.security.AccessDeniedException: Insufficient permissions (user=***/******.COM, scope=hbase:meta, params=[table=hbase:meta,],action=EXEC)
```
Full stacktrace: https://gist.github.com/pan3793/46a3f6b956a7982646e1ee75603a1865

### Why are the changes needed?

Improve the diagnosis experience.

### Does this PR introduce _any_ user-facing change?

Yes, the user would see rich error messages when HBase/Hive DelegationTokenProvider hit exceptions.

### How was this patch tested?

Manual test.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #51320 from pan3793/SPARK-52613.

Authored-by: Cheng Pan <[email protected]>
Signed-off-by: Kent Yao <[email protected]>
(cherry picked from commit e8384d5)
Signed-off-by: Kent Yao <[email protected]>
@yaooqinn
Copy link
Member

yaooqinn commented Jul 3, 2025

Merged to master and 4.0, thank you @pan3793 @dongjoon-hyun

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.

3 participants