You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yarn-dev@hadoop.apache.org by "Íñigo Goiri (Jira)" <ji...@apache.org> on 2022/11/09 18:27:00 UTC

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

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

Íñigo Goiri resolved YARN-11367.
--------------------------------
    Fix Version/s: 3.4.0
     Hadoop Flags: Reviewed
       Resolution: Fixed

> [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
>             Fix For: 3.4.0
>
>
> 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-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: yarn-dev-help@hadoop.apache.org