hadoop-yarn-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Miklos Szegedi (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (YARN-6033) Add support for sections in container-executor configuration file
Date Tue, 08 Aug 2017 00:17:00 GMT

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

Miklos Szegedi commented on YARN-6033:
--------------------------------------

{code}
485      cfg->size = 0;
486      conf_file = fopen(file_path, "r");
487      if (conf_file == NULL) {
488        fprintf(ERRORFILE, "Invalid conf file provided, unable to open file"
489            " : %s \n", file_path);
490        return (INVALID_CONFIG_FILE);
491      }
492    
493      cfg->sections = (struct section **) malloc(
494            sizeof(struct section *) * MAX_SIZE);
{code}
I already commented on this but now I have the proof how it can go wrong. If populate_section_fields
does not get any new entries, then cfg->sections is malloced but cfg->size=0. That means
that is this code will not free the memory:
{code}
70      if (cfg->size > 0) {
71        free(cfg->sections);
72      }
{code}
It should rather be:
{code}
      if (cfg->sections) {
        free(cfg->sections);
        cfg->sections = NULL; 
      }
{code}
-
{code}
36        return_values = (char **) malloc(sizeof(char *) * return_values_size);
37        memset(return_values, 0, sizeof(char *) * return_values_size);
{code}
There is no NULL check here.
{code}
50          // Make sure returned values has enough space for the trailing NULL.
51          if (size >= return_values_size - 2) {
{code}
The code needs to make sure that there is one item free, either for NULL, or for the next
item. So I do not think that you need the -2 here.

> Add support for sections in container-executor configuration file
> -----------------------------------------------------------------
>
>                 Key: YARN-6033
>                 URL: https://issues.apache.org/jira/browse/YARN-6033
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>          Components: nodemanager
>            Reporter: Varun Vasudev
>            Assignee: Varun Vasudev
>         Attachments: YARN-6033.003.patch, YARN-6033.004.patch, YARN-6033.005.patch, YARN-6033.006.patch,
YARN-6033.007.patch, YARN-6033.008.patch, YARN-6033.009.patch, YARN-6033.010.patch, YARN-6033.011.patch,
YARN-6033-YARN-5673.001.patch, YARN-6033-YARN-5673.002.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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


Mime
View raw message