> On May 29, 2019, 6:02 p.m., Benjamin Mahler wrote:
> > src/tests/master/mock_master_api_subscriber.cpp
> > Lines 131-134 (patched)
> > <https://reviews.apache.org/r/70671/diff/3/?file=2146934#file2146934line131>
> >
> >     If possible, we prefer to use the "managed=true" approach to avoid 
> > self-wait deadlocks:
> >     
> >     ```
> >     PID<MockMasterAPISubscriberProcess> process =
> >       spawn(new MockMasterAPISubscriberProcess(this), true);
> >       
> >     ...
> >     
> >     terminate(process);
> >     // no need to wait
> >     ```
> >     
> >     However, it looks like that's not possible here since the process holds 
> > a back pointer to `this`? Perhaps it's worth noting that:
> >     
> >     ```
> >       // Note that we must wait for the process to terminate before we leave
> >       // the destructor (and therefore cannot spawn the process with 
> > `managed=true`)
> >       // since the process may invoke the mock methods on this class.
> >       terminate(process.get());
> >       wait(process.get());
> >     ```
> 
> Andrei Sekretenko wrote:
>     Hmm... That's a good question. 
>     I've recently (after refactoring a couple of existing master API tests) 
> started to run into some deadlock on termination once in a while. Probably 
> that's what's going on - I'll have a look.

I've converted the code to use a managed process - however, this didn't help as 
this deadlock was not related to self-wait. See 
https://issues.apache.org/jira/browse/MESOS-9808.

The deadlock was being triggered by terminating the Reader's internal process 
while hoilding a ProcessReference to the MockMasterAPISubscriberProcess (in one 
thread) and performing cleanup of MockMasterAPISubscriberProcess (in another 
thread).

I've implemented a workaround: now the MockMasterAPISubscriberProcess is 
terminated only after the loop (which owns the Reader) exits.


- Andrei


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/70671/#review215579
-----------------------------------------------------------


On June 3, 2019, 7:55 p.m., Andrei Sekretenko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/70671/
> -----------------------------------------------------------
> 
> (Updated June 3, 2019, 7:55 p.m.)
> 
> 
> Review request for mesos, Benno Evers, Benjamin Mahler, and Joseph Wu.
> 
> 
> Bugs: MESOS-7258
>     https://issues.apache.org/jira/browse/MESOS-7258
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This patch introduces a class with mock methods for subscribing to the
> events of master's V1 streaming API and setting expectations for them.
> 
> 
> Diffs
> -----
> 
>   src/Makefile.am 5f97523fbe2d80733fbdcc7706f2761f5a071f9f 
>   src/tests/CMakeLists.txt e6b1d8a097246f0921467d7f778034d6754fcff6 
>   src/tests/master/mock_master_api_subscriber.hpp PRE-CREATION 
>   src/tests/master/mock_master_api_subscriber.cpp PRE-CREATION 
> 
> 
> Diff: https://reviews.apache.org/r/70671/diff/5/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Andrei Sekretenko
> 
>

Reply via email to