-
Notifications
You must be signed in to change notification settings - Fork 29.1k
[SPARK-41365][UI] Stages UI page fails to load for proxy in specific yarn environment #38882
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change in the second place is necessary, at least the page can be opened normally and code logic has not changed.
| // Decode URI twice here to avoid percent-encoding twice on the query string | ||
| val decodeURI = URLDecoder.decode(uriInfo.getRequestUri.getRawQuery, UTF_8.name()) | ||
| val uriQueryParameters = new ImmutableMultivaluedMap[String, String]( | ||
| UriComponent.decodeQuery(decodeURI, true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if decoding twice is appropriate here.
If do not change here, the stage page can be opened, but the task sort column button cannot be clicked (locality level etc.)
Given the change before, I think it is reasonable.
https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/ui/UIUtils.scala#L626
| } | ||
| withUI(_.store.taskList(stageId, stageAttemptId, pageStartIndex, pageLength, | ||
| indexName(columnNameToSort), isAscendingStr.equalsIgnoreCase("asc"))) | ||
| indexName(columnNameToSort), "asc".equalsIgnoreCase(isAscendingStr))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isAscendingStr may be NPE if URI was encoded twice.
After change here, at least the stage page can be opened now
|
Can one of the admins verify this patch? |
|
+CC @gengliangwang |
|
@yabola could you add reproduce steps or tests for the issue? |
|
@gengliangwang |
|
@gengliangwang |
|
@yabola From the screenshot you provided, I don't see any double-quoted URL like |
|
@gengliangwang Yes, but the URI will be processed by yarn proxy (encoded twice). I collect URIInfo in the interface ( WEB UI request(screenshot): uriInfo.getRequestUri : |
|
@yabola I am not quite sure about the "yarn proxy" you mentioned. |
@gengliangwang I check Executor page requests don't have query params (not sure about all) , so it work well. |
|
@yabola ok, can you try adding a new test case for it? |
|
@gengliangwang I add new UT and change codes to carefully decode each parameter, I think it aligns with the previous behavior and is more accurate ( I reuse origin decodeURLParameter codes , It supports multiple decode). How do you feel it? spark/core/src/main/scala/org/apache/spark/ui/UIUtils.scala Lines 624 to 637 in b5a9e1f
|
|
@gengliangwang If you have time, please have a look, thanks. And do I need to change codes to decode parameters only twice here? |
|
@yabola Thanks for the fix. The changes LGTM. |
|
@yabola There is merge conflict on branch-3.3. Could you create a backport PR against branch-3.3? |
|
@gengliangwang @mridulm Thank you all~ I had created back port PR #39087 |
…ific yarn environment backport #38882 ### What changes were proposed in this pull request? Stages UI page fails to load for proxy in some specific yarn environment. ### Why are the changes needed? My environment CDH 5.8 , click to enter the spark UI from the yarn Resource Manager page when visit the stage URI, it fails to load, URI is http://<yarn-url>:8088/proxy/application_1669877165233_0021/stages/stage/?id=0&attempt=0 The issue is similar to, the final phenomenon of the issue is the same, because the parameter encode twice [SPARK-32467](https://issues.apache.org/jira/browse/SPARK-32467) [SPARK-33611](https://issues.apache.org/jira/browse/SPARK-33611) The two issues solve two scenarios to avoid encode twice: 1. https redirect proxy 2. set reverse proxy enabled (spark.ui.reverseProxy) in Nginx But if encode twice due to other reasons, such as this issue (yarn proxy), it will also fail when visit stage page. It is better to decode parameter twice here. Just like fix here [SPARK-12708](https://issues.apache.org/jira/browse/SPARK-12708) [codes](https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/ui/UIUtils.scala#L626) ### Does this PR introduce any user-facing change? No ### How was this patch tested? new added UT Closes #39087 from yabola/fixui-backport. Authored-by: chenliang.lu <marssss2929@gmail.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>

What changes were proposed in this pull request?
Stages UI page fails to load for proxy in some specific yarn environment.
Why are the changes needed?
My environment CDH 5.8 , click to enter the spark UI from the yarn Resource Manager page
when visit the stage URI, it fails to load, URI is
http://:8088/proxy/application_1669877165233_0021/stages/stage/?id=0&attempt=0
The issue is similar to, the final phenomenon of the issue is the same, because the parameter encode twice
SPARK-32467
SPARK-33611
The two issues solve two scenarios to avoid encode twice:
But if encode twice due to other reasons, such as this issue (yarn proxy), it will also fail when visit stage page.
It is better to decode parameter twice here.
Just like fix here SPARK-12708 codes
Does this PR introduce any user-facing change?
No
How was this patch tested?
new added UT