----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/21379/#review46166 -----------------------------------------------------------
Ship it! Ok looks great. I made a few changes to fix an issue, there is still one minor issue that we're not likely to encounter. -> If two slaves are being spawned at the same time (both inside Slave::initialize), then they might concurrently access 'signalWrapper'! 3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp <https://reviews.apache.org/r/21379/#comment81424> Whoops, this shouldn't be here, right? ;) src/slave/slave.cpp <https://reviews.apache.org/r/21379/#comment81430> Let's just call this 'signalHandler'? src/slave/slave.cpp <https://reviews.apache.org/r/21379/#comment81427> I'll update this to use Result<string> src/slave/slave.cpp <https://reviews.apache.org/r/21379/#comment81447> We can't use LOG(WARNING) within the execution of the signal handler. I'll proceed with the following change, let me know if it doesn't make sense to you: (1) Make Slave::signaled a non-static member function. (2) Store a 'defer(self(), Slave::signaled, lambda::_1, lambda::_2)' inside 'signaledWrapper'. This lets us bind in the PID as you mentioned. This way, the only thing we do inside the signal handler is dispatch. src/slave/slave.cpp <https://reviews.apache.org/r/21379/#comment81449> We could just send this message to the shutdown method instead of also logging here. src/slave/slave.cpp <https://reviews.apache.org/r/21379/#comment81426> We avoid using periods at the end of log messages because it's hard to consistently do it and for it to be clear when the end of the message has a variable string. For example: // Will the period look to be part of the user? // Annoying to have to suffix << "." LOG(INFO) << "User " << user << "."; - Ben Mahler On June 8, 2014, 10:42 a.m., Alexandra Sava wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/21379/ > ----------------------------------------------------------- > > (Updated June 8, 2014, 10:42 a.m.) > > > Review request for mesos and Ben Mahler. > > > Bugs: MESOS-544 > https://issues.apache.org/jira/browse/MESOS-544 > > > Repository: mesos-git > > > Description > ------- > > First phase: Mesos-slave support for "node drain" > > > This phase handles the shutdown of the slave, triggered by SIGUSR1 signal: > * implement a signal handler which is invoked when SIGUSR1 signal is issued > * the signal handler will dispatch the 'shutdown' method of the Slave class, > which shuts down all the frameworks and executors that run on the slave. > > In the next phase, the slave will send an unregistration request to the > master in order to overcome the lag of the health check timer (75 sec). > > > Diffs > ----- > > 3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp > 72f3e70ccc189d0a7dd613ccaf79537d3587c49c > src/slave/slave.hpp 34687e555e6ba07863c45840aa6d07717388cf62 > src/slave/slave.cpp 643c0882a4bab1b612b3fb6fd1004e09edf5f368 > > Diff: https://reviews.apache.org/r/21379/diff/ > > > Testing > ------- > > > Thanks, > > Alexandra Sava > >
