You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yarn-issues@hadoop.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/11/02 11:06:00 UTC

[jira] [Updated] (YARN-11367) [Federation] Fix DefaultRequestInterceptorREST Client NPE

     [ https://issues.apache.org/jira/browse/YARN-11367?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ASF GitHub Bot updated YARN-11367:
----------------------------------
    Labels: pull-request-available  (was: )

> [Federation] Fix DefaultRequestInterceptorREST Client NPE
> ---------------------------------------------------------
>
>                 Key: YARN-11367
>                 URL: https://issues.apache.org/jira/browse/YARN-11367
>             Project: Hadoop YARN
>          Issue Type: Bug
>          Components: federation, router
>    Affects Versions: 3.4.0
>            Reporter: fanshilun
>            Assignee: fanshilun
>            Priority: Major
>              Labels: pull-request-available
>
> YARN-8529. Add timeout to RouterWebServiceUtil#invokeRMWebService.
> This JIRA only considers the case of Create InterceptorChain, and initializes the client in the DefaultRequestInterceptorREST#init method
> {code:java}
> @Override
> public void init(String user) {
>   webAppAddress = WebAppUtils.getRMWebAppURLWithScheme(getConf());
>   client = RouterWebServiceUtil.createJerseyClient(getConf());
> } {code}
> However, FederationInterceptorREST#createInterceptorForSubCluster will create DefaultRequestInterceptorREST of different SubClusters. This part does not initialize the Client, resulting in NPE when calling.
> {code:java}
> private DefaultRequestInterceptorREST createInterceptorForSubCluster(
>     SubClusterId subClusterId, String webAppAddress) {
>   final Configuration conf = this.getConf();
>   String interceptorClassName = conf.get(
>       YarnConfiguration.ROUTER_WEBAPP_DEFAULT_INTERCEPTOR_CLASS,
>       YarnConfiguration.DEFAULT_ROUTER_WEBAPP_DEFAULT_INTERCEPTOR_CLASS);
>   DefaultRequestInterceptorREST interceptorInstance = null;
>   try {
>     Class<?> interceptorClass = conf.getClassByName(interceptorClassName);
>     if (DefaultRequestInterceptorREST.class
>         .isAssignableFrom(interceptorClass)) {
>       interceptorInstance = (DefaultRequestInterceptorREST) ReflectionUtils
>           .newInstance(interceptorClass, conf);
>     } else {
>       throw new YarnRuntimeException(
>           "Class: " + interceptorClassName + " not instance of "
>               + DefaultRequestInterceptorREST.class.getCanonicalName());
>     }
>   } catch (ClassNotFoundException e) {
>     throw new YarnRuntimeException(
>         "Could not instantiate ApplicationMasterRequestInterceptor: "
>             + interceptorClassName,
>         e);
>   }
>   String webAppAddresswithScheme =
>       WebAppUtils.getHttpSchemePrefix(this.getConf()) + webAppAddress;
>   interceptorInstance.setWebAppAddress(webAppAddresswithScheme);
>   interceptorInstance.setSubClusterId(subClusterId);
>   // Missing initialization DefaultRequestInterceptorREST#Client Code  
>   interceptors.put(subClusterId, interceptorInstance);
>   return interceptorInstance;
> } {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: yarn-issues-help@hadoop.apache.org