You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by "Zhong Yanghong (Jira)" <ji...@apache.org> on 2020/11/20 01:41:00 UTC

[jira] [Commented] (KYLIN-3482) Unclosed SetAndUnsetThreadLocalConfig in SparkCubingByLayer

    [ https://issues.apache.org/jira/browse/KYLIN-3482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17235822#comment-17235822 ] 

Zhong Yanghong commented on KYLIN-3482:
---------------------------------------

[~shaofengshi], It seems the patch for closing will have bad effect in *SparkCubingByLayer*. 

For example, after applying the patch
{code}
public void init() {
             KylinConfig kConfig = AbstractHadoopJob.loadKylinConfigFromHdfs(conf, metaUrl);
             try (KylinConfig.SetAndUnsetThreadLocalConfig autoUnset = KylinConfig
                     .setAndUnsetThreadLocalConfig(kConfig)) {
                 CubeInstance cubeInstance = CubeManager.getInstance(kConfig).getCube(cubeName);
                 cubeDesc = cubeInstance.getDescriptor();
                 aggregators = new MeasureAggregators(cubeDesc.getMeasures());
                 measureNum = cubeDesc.getMeasures().size();
             }
         }
{code}

After init(), the KylinConfig will be removed. Then it will fail to call KylinConfig.getInstanceFromEnv(). 

> Unclosed SetAndUnsetThreadLocalConfig in SparkCubingByLayer
> -----------------------------------------------------------
>
>                 Key: KYLIN-3482
>                 URL: https://issues.apache.org/jira/browse/KYLIN-3482
>             Project: Kylin
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Assignee: Jiatao Tao
>            Priority: Minor
>             Fix For: v2.5.0
>
>
> Here is related code:
> {code}
>                                     KylinConfig kylinConfig = AbstractHadoopJob.loadKylinConfigFromHdfs(sConf, metaUrl);
>                                     KylinConfig.setAndUnsetThreadLocalConfig(kylinConfig);
> {code}
> The return value from setAndUnsetThreadLocalConfig should be closed.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)