hadoop-yarn-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wangda Tan (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (YARN-2708) Potential null dereference in CommonNodeLabelsManager#internalRemoveLabelsFromNode()
Date Fri, 17 Oct 2014 21:51:33 GMT

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

Wangda Tan commented on YARN-2708:
----------------------------------

[~ted_yu],
Thanks for reporting this, however, the {{internalRemoveLabelsFromNode}} is called after {{checkRemoveLabelsFromNode}}.
And the {{checkRemoveLabelsFromNode}} will check existence of all required NMs. If any of
them doesn't exist, it will report error before invoke {{internalRemoveLabelsFromNode}}. Like


{code}
      if (!nodeExisted) {
        String msg =
            "Try to remove labels from NM=" + nodeId
                + ", but the NM doesn't existed";
        LOG.error(msg);
        throw new IOException(msg);
      }
{code}

Does this make sense to you?

Thanks,
Wangda

> Potential null dereference in CommonNodeLabelsManager#internalRemoveLabelsFromNode()
> ------------------------------------------------------------------------------------
>
>                 Key: YARN-2708
>                 URL: https://issues.apache.org/jira/browse/YARN-2708
>             Project: Hadoop YARN
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Priority: Minor
>
> Here is the code (around line 475):
> {code}
>       if (nodeId.getPort() == WILDCARD_PORT) {
>         Host host = nodeCollections.get(nodeId.getHost());
>         host.labels.removeAll(labels);
>         newNMToLabels.put(nodeId, host.labels);
>       } else {
>         Node nm = getNMInNodeSet(nodeId);
>         if (nm.labels != null) {
> {code}
> nm may be null in else block.
> In other places, node is created if non-existent:
> {code}
>       } else {
>         createNodeIfNonExisted(nodeId);
>         Node nm = getNMInNodeSet(nodeId);
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message