It may be the 20 timer limit, although the imp.wakeup that eventually goes missing is simply re-triggering itself as per this stripped down equivalent I have tested:
count <- 0;
local ref=imp.wakeup(0.01, checkTime);
server.error("Checktime timer failed");
if(count%100==0) server.log(count+" "+now.min);
This speeded-up test passes of course - and by “passing” I mean when I look at the number of 30 second callbacks between my last update of the full code and when I recently noticed it fail (approx. 22 days which is in the order of 63360 callbacks) I was suspicious of a 2^16 limit but the above test carries on beyond this.
My full agent code does have other timers that are not so easily tested (part of a http request queue) so I’ll wrap some more debug around there.
What was perplexing me was that the checkTime function could apparently just vanish without reporting that it was unable to schedule another callback of itself. Incidentally, I appreciate that this isn’t truly recursive so there should be no resource limitiation to one imp.wakeup callback scheduling another instance of itself like this.