Adar Dembo has posted comments on this change. ( http://gerrit.cloudera.org:8080/8116 )
Change subject: periodic: prevent runaway callback loops ...................................................................... Patch Set 1: (2 comments) http://gerrit.cloudera.org:8080/#/c/8116/1/src/kudu/rpc/periodic-test.cc File src/kudu/rpc/periodic-test.cc: http://gerrit.cloudera.org:8080/#/c/8116/1/src/kudu/rpc/periodic-test.cc@193 PS1, Line 193: kPeriods * 2 > Just a question to make sure I understand this correctly. In a sense it's exactly two tasks per period: the first one runs "timer->Stop();timer->Start()" and reschedules itself, and the second one just notices that the current generation has changed and exits. But, because "timer->Stop();timer->Start()" resets the period, we don't end up running a full 10 periods, it's more like 8 or 9. Hence ASSERT_LE and not ASSERT_EQ. I suppose it's possible for the number of tasks to _exceed_ kPeriods*2 if SleepFor() ends up sleeping for a few extra periods, but I didn't see that happen when I looped the test 1000 times in TSAN mode with stress threads. http://gerrit.cloudera.org:8080/#/c/8116/1/src/kudu/rpc/reactor.cc File src/kudu/rpc/reactor.cc: http://gerrit.cloudera.org:8080/#/c/8116/1/src/kudu/rpc/reactor.cc@101 PS1, Line 101: METRIC_DEFINE_counter(server, reactor_delayed_tasks_completed, > is this actually useful in a production context or just for tests? if the l Just for tests, though I thought it was a neat curiosity of sorts. I'll do something equivalent in PeriodicTimer instead. -- To view, visit http://gerrit.cloudera.org:8080/8116 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I37bfd547db2a6c58d15d228979c88b9b871f72c5 Gerrit-Change-Number: 8116 Gerrit-PatchSet: 1 Gerrit-Owner: Adar Dembo <a...@cloudera.com> Gerrit-Reviewer: Adar Dembo <a...@cloudera.com> Gerrit-Reviewer: Alexey Serbin <aser...@cloudera.com> Gerrit-Reviewer: Kudu Jenkins Gerrit-Reviewer: Todd Lipcon <t...@apache.org> Gerrit-Comment-Date: Fri, 22 Sep 2017 21:15:06 +0000 Gerrit-HasComments: Yes