Details
-
Bug
-
Status: Accepted
-
Major
-
Resolution: Unresolved
-
1.1.2, 1.2.1, 1.3.0, 1.4.0, 1.5.1, 1.6.1, 1.7.0
-
None
-
None
-
5
Description
FUTURE_DISPATCH uses DispatchMatcher to figure out whether a processed DispatchEvent is the same the user is waiting for. However, comparing std::type_info of function pointers is not enough: different class methods with same signatures will be matched. Here is the test that proves this:
class DispatchProcess : public Process<DispatchProcess> { public: MOCK_METHOD0(func0, void()); MOCK_METHOD1(func1, bool(bool)); MOCK_METHOD1(func1_same_but_different, bool(bool)); MOCK_METHOD1(func2, Future<bool>(bool)); MOCK_METHOD1(func3, int(int)); MOCK_METHOD2(func4, Future<bool>(bool, int)); };
TEST(ProcessTest, DispatchMatch) { DispatchProcess process; PID<DispatchProcess> pid = spawn(&process); Future<Nothing> future = FUTURE_DISPATCH( pid, &DispatchProcess::func1_same_but_different); EXPECT_CALL(process, func1(_)) .WillOnce(ReturnArg<0>()); dispatch(pid, &DispatchProcess::func1, true); AWAIT_READY(future); terminate(pid); wait(pid); }
The test passes:
[ RUN ] ProcessTest.DispatchMatch [ OK ] ProcessTest.DispatchMatch (1 ms)
This change was introduced in https://reviews.apache.org/r/28052/.
Attachments
Issue Links
- is related to
-
MESOS-8662 Consider introducing a clang-tidy check to catch ambiguous use of FUTURE_DISPATH
- Open
- relates to
-
MESOS-5887 Enhance DispatchEvent to include demangled method name.
- Open
- links to