You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "haosdent (JIRA)" <ji...@apache.org> on 2015/09/20 20:15:04 UTC

[jira] [Commented] (MESOS-3475) TestContainerizer should not modify global environment variables

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

haosdent commented on MESOS-3475:
---------------------------------

Hi, [~jvanremoortere] Do you refer this code snippet
{code}
  // TODO(benh): Can this be removed and done exlusively in the
  // 'executorEnvironment()' function? There are other places in the
  // code where we do this as well and it's likely we can do this once
  // in 'executorEnvironment()'.
  foreach (const Environment::Variable& variable,
           executorInfo.command().environment().variables()) {
    os::setenv(variable.name(), variable.value());
  }

  os::setenv("MESOS_LOCAL", "1");

  driver->start();

  os::unsetenv("MESOS_LOCAL");

  // Unset the environment variables we set by resetting them to their
  // original values and also removing any that were not part of the
  // original environment.
  foreachpair (const string& name, const string& value, original) {
    os::setenv(name, value);
  }

  foreachkey (const string& name, environment) {
    if (!original.contains(name)) {
      os::unsetenv(name);
    }
  }
{code}

> TestContainerizer should not modify global environment variables
> ----------------------------------------------------------------
>
>                 Key: MESOS-3475
>                 URL: https://issues.apache.org/jira/browse/MESOS-3475
>             Project: Mesos
>          Issue Type: Bug
>            Reporter: Joris Van Remoortere
>
> Currently the {{TestContainerizer}} modifies the environment variables. Since these are global variables, this can cause other threads reading these variables to get inconsistent results, or even segfault if they happen to read while the environment is being changed.
> Synchronizing within the TestContainerizer is not sufficient. We should pass the environment variables into a fork, or set them on the command line of an execute.



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