[
https://issues.apache.org/jira/browse/YARN-11941?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Benjamin Teke resolved YARN-11941.
----------------------------------
Hadoop Flags: Reviewed
Resolution: Fixed
> Follow-up to YARN-11937: Fix NPE and improve parameter detection for
> yarn.web-proxy.redirect-flag
> -------------------------------------------------------------------------------------------------
>
> Key: YARN-11941
> URL: https://issues.apache.org/jira/browse/YARN-11941
> Project: Hadoop YARN
> Issue Type: Improvement
> Components: yarn
> Affects Versions: 3.5.1
> Reporter: Gabor Roczei
> Priority: Major
> Labels: pull-request-available
>
> *Problem Statement*
> The fix for YARN-11937 introduced a mechanism to handle yarn_knox_proxy=true
> (yarn.web-proxy.redirect-flag=yarn_knox_proxy) parameter in the HTTP query.
> However the current implementation might not correctly identify this
> parameter when it is part of a larger query string containing multiple
> parameters. For example in the following URL:
> {code:java}
> ...?parameter1=true¶meter2=true&yarn_knox_proxy=true&doAs=user{code}
> Currently the logic expects the query string to be exactly
> yarn_knox_proxy=true, it will fail to recognize the flag when other
> parameters (like doAs, parameter1, or parameter2) are present.
> [https://github.com/apache/hadoop/blob/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/WebAppProxyServlet.java#L555]
> {code:java}
> String redirectFlagName =
> conf.get(YarnConfiguration.PROXY_REDIRECT_FLAG, "");
> if (!redirectFlagName.isBlank() &&
> toFetch.getQuery().equals(redirectFlagName + "=true")) {
> ProxyUtils.sendRedirect(req, resp, toFetch.toString());
> return;
> }{code}
> If the {{toFetch}} URI does not contain a query string, the current logic
> throws a {{java.lang.NullPointerException}} when attempting to call
> {{.equals()}} on the null result. This scenario is common in Spark Client
> mode when the tracking URL points directly to the Spark UI
> ([http://host.example.com:4040|http://host.example.com:4040/]). In such cases
> the absence of a query string causes the current implementation to fail with
> a NullPointerException.
>
> *Proposed Changes*
> * Robust parsing{*}:{*} Instead of a simple string comparison, the logic
> will safely check for the presence of the redirect flag within the query
> string, even when combined with other parameters.
> * Null Safety{*}:{*} Add a null check for {{toFetch.getQuery()}} to prevent
> {{NullPointerException}} when no query parameters are present in the URI.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]