Cron service broken

Hello,
I've noticed that cron schedules have stopped working on my hub.

Here is a simple code that I used to verify this before I sent this message:

definition(
    name: "TEST APP",
    namespace: "elfege",
    author: "ELFEGE",

    description: """TEST""",

    category: "Green Living",
    iconUrl: "https://www.philonyc.com/assets/penrose.jpg",
    iconX2Url: "https://www.philonyc.com/assets/penrose.jpg",
    iconX3Url: "https://www.philonyc.com/assets/penrose.jpg", 
    image: "https://www.philonyc.com/assets/penrose.jpg"
)

preferences {

}

def installed()
{
    log.debug "installed with settings: $settings"
    init()
    master()
}

def updated()
{
    log.info "updated with settings: $settings"
    unschedule()
    unsubscribe()
    init()
    master()
}

def init()
{
   
    schedule("0 0/1 * * * ?", master) 

}

def handler(evt)
{
    log.debug "$evt.device is $evt.value"
}

def master()
{
    log.debug "**********${new Date().format("h:mm:ss a", location.timeZone)}**************** "
}

And, below, the debug: you'll notice the current time on the bottom right corner of the picture. This cron schedule should run the master() loop every one minute, but it doesn't.

I suppose a simple reboot should fix this, but it's happening almost every day since a couple firmware updates ago.

After a reboot:

Whatever is happening is unique to your hub - as the screenshot indicates it is running once a minute at 00 seconds on my HE (Platform 2.1.8.117).

I figured, since I myself posted a screenshot of it working after a fresh reboot. My question, in fact, is more about trying to figure out where to look and how to fix this. Whether or not it's only on my hub, it's still a hub's core system failing and I have no idea where to look, beside deactivating all custom code, which I have done countless times with no positive results. I also tried resetting the hub and restoring my db and it kinda of fix the problem for a couple days but then it happens again.

In a previous thread that I had created I had notified Hubitat of issues with the runIn() method and they said they were looking into it. I wonder if it is not related but for that I'd need to see if other people met with the same issue.

We are investigating this issue.

2 Likes

Thank you very much @bravenel for doing so and, again, it's amazing to know that your team shows so much reactivity. It's really a breeze when compared to what I had gotten used to in a relatively near past...

Any time line? I have 0 reliability on any time trigger on my platform...

If this can be of any help: One of my custom apps, named "Advanced Motion Lighting Management" has a feature to log a warning message "CRON SERVICE BROKEN" every time it detects that the expected delay for a scheduled task has passed by more than 30 seconds. Maybe this can help you see precisely when it happens in order to determine a probable cause within other concomitant logs.

I use this app under the following instances names: "motion bathroom", "motion office", "motion kitchen".

It's somewhat ironic that you are using the scheduler to determine 30 seconds have elapsed (how else could you do that?). Our next release, 2.1.9, may resolve this issue for you. Thanks for your patience.

2 Likes

I'm not sure to get what you mean. I'm using state.nowTime = now() then compare the values to see how much time has passed since last execution, so I'm not using the scheduler

@bravenel ... forgot to mention that my app listens to several motion sensors which are then used as triggers; so if schedules aren't working, it'll be able to measure the time discrepancy after being triggered by motion events. That's how it detects cron is down without, of course, using cron itself or any type of schedule.

In the meantime I wrote this little app that works as a watchdog. Using motion sensors as triggers and a 1 minute schedule, it'll detect when the task hasn't run for longer than the built-in schedule requires and reboot your hub