> On March 3, 2016, 5:55 a.m., Bernd Mathiske wrote: > > src/tests/slave_recovery_tests.cpp, line 3461 > > <https://reviews.apache.org/r/43629/diff/4/?file=1278087#file1278087line3461> > > > > Why was this moved up here? Couldn't this be in line 3389/3402? > > Joseph Wu wrote: > In this case, it's because all injections of `Try<Owned<cluster::Slave>> > slave` must be stack-allocated above. Even though we use `containerizer2` > much later, if we put it lower down, it would be deallocated before the > second `slave` (and then segfault!). > > Bernd Mathiske wrote: > I am not following yet. > > 1. How could it be deallocated before it has been allocated? How could it > even be referenced then? I assume "it" refers to sontainerizer2. > 2. The second slave would still be constructed later than containerizer2. > > Joseph Wu wrote: > In the updated test, the items go on the stack like this: > ``` > containerizer1 > containerizer2 > slave > ``` > > If I don't move `containerizer2` up, the stack will look like this: > ``` > containerizer1 > slave > containerizer2 > ``` > because re-constructing `slave` doesn't change `slave`'s order in the > stack.
So it's about the destruction order, not the construction order. Good point! - Bernd ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/43629/#review121854 ----------------------------------------------------------- On March 4, 2016, 3:55 p.m., Joseph Wu wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/43629/ > ----------------------------------------------------------- > > (Updated March 4, 2016, 3:55 p.m.) > > > Review request for mesos, Bernd Mathiske and Artem Harutyunyan. > > > Bugs: MESOS-4633 and MESOS-4634 > https://issues.apache.org/jira/browse/MESOS-4633 > https://issues.apache.org/jira/browse/MESOS-4634 > > > Repository: mesos > > > Description > ------- > > Continuation of https://reviews.apache.org/r/43615/ with a slightly different > pattern. > > > Diffs > ----- > > src/tests/fetcher_cache_tests.cpp f9c48f5d938c2601cb8f826029d6969d676ab98e > src/tests/resource_offers_tests.cpp > 0bad45dd1dabecc88fef1ab46e8ea26718070b33 > src/tests/slave_recovery_tests.cpp bd7b94f3f1fac6705e5bf14c6f6103b540cde56c > > Diff: https://reviews.apache.org/r/43629/diff/ > > > Testing > ------- > > Tests are run at the end of this review chain. > > > Thanks, > > Joseph Wu > >