New Memory Leak in last 3 months

Hello all,

I have a C-7 running 2.3.6.144. An update some time in the last few months (I want to say mid-130s) introduced a memory leak and now every week or so the hub reports being low on memory.

I’m at a loss for how to diagnose what is going on. I made zero changes other than updating the firmware before seeing OOM errors, and it ran without issue for about two years prior to that.

Is there any tooling available I can use to isolate the problem? Thanks!

You can always roll back to the previous version.

1 Like

Do a soft rest. I had something similar a month ago and after I did a soft rest and restore it was resolved. This fixes any database correction that could be causing your issue.

1 Like

First thig to do is to go to Settings > Backups
Download a local backup and then restore it right away (this will also do a soft reset as part of the restore).

Monitor it after this, there is a good chance this will fix it.

1 Like

So, I have been getting a slow memory leak and wondering if as mentioned above that it is related to any database issues. Again, as mentioned above it seems as though performing a local backup and immediate restore is worth a shot as a possible remedy.

But, I have read in other areas that not everything is restored as it was before when performing a restore. Ie, I may have to re-pair Zigbee devices etc.

Can anyone confirm what the repercussions may be after restoring from a local backup?

Yes the radio data is not restored, but it is also not deleted. You will be in the same state as you were before. Just make sure to download the backup. There was ONE case where the persons backups were all corrupted somehow and they had to go back further to an old backup. So it is 99.999% safe I would say.

With that said, this has been made even easier in 2.3.7. I would update and then when you go to reboot there is an option to rebuild the database. This gets you the same results with only having to click that checkbox. You may want to download a copy of a recent backup before as good practice, again, just to be extra safe.

2.3.7 also had a bunch of memory fixes during beta, so with updating and a DB rebuild you should see greatly increased memory endurance.

1 Like

Is rebooting after an update still recommended/necessary?

No I don't think so, just if you want to use that new database rebuild checkbox you have to update first then reboot to use it.

1 Like

I appreciate the quick response. I apologize if I am a little thick headed. But, just so I understand.

  1. Create a backup first.
  2. Then immediately restore that backup.
  3. Once the restore is complete, reboot and check the box to rebuild a new database.

What I am not sure I understand is you say that "the radio data is not restored but it is also not deleted. But I will be in the same state as before. "

So, if that is the case, what if anything needs to be done to restore the radio data?

Basically what I am asking is if I will need to perform any type of rebuilding or re-pairing of any devices, ie zwave, zigbee or any links to cloud apps, webcore rules, devices labels, etc... pretty much anything and everything? I just want to be back to the way I was before the restore with little to no maintenance. But hopefully fixing the memory leak issue.

One other thing... what exactly does rebuilding the database do?

No, this is all you need to do

  1. Create and download a backup
  2. Update the hub to 2.3.7
  3. Reboot and check the rebuild database option on the confirmation dialog

If you don't want to update to 2.3.7 then you would need to do the backup/restore, the rebuild was added in 2.3.7.

Nothing, because it wont be deleted. The only way the radio data would be removed is if you do a full hub reset or a radio reset, both of which are now hidden from the normal UI to prevent support nightmares. The only way to restore the radio is from a hub protect cloud backup, and is intended for if your hub is totally dead and needs to be replaced.

No, reboot and rebuild, thats it, nothing else needs to be done.

1 Like

Got it. Done. We’ll see what happens.

Thank you!

Memory leaker checking in.

I'll apply the recommended solution then report back.

1 Like

Update went through. I rebooted and everything worked.

I guess I need to wait and see ?

Yes if you also did the database rebuild you should see much better memory endurance. I ran one of the later beta builds for 6 days and the memory only dropped about 10mb over the entire 6 days.

You can track the free memory history with this endpoint if you want (replace hubitat.local with your hub IP if not working).

http://hubitat.local/hub/advanced/freeOSMemoryHistory

3 Likes

How often does this need to be done? How often can it be done without any other ill effects?

For rebuild database, only as needed. Often time the first step in troubleshooting unexplained problems has been a soft reset and backup restore, this does the same thing so it much easier to explain and less scary to do.

If you ever have the hub lose power without being shut down properly it would not be a bad idea to do it.

There is some risk in doing it, if it cannot pull a good backup for some reason you may have to restore further back. Risk is very low, issues with a soft reset / restore only comes up once in a great while.

1 Like

Another good way to watch memory is to graph it. In this is example I'm using @thebearmay 's Hubitat Information Manager and Webcore's graphing (formaly Hubitgraphs) I also have a rule that if memory drops below 120k it reboots at 3am when no one notices.

2 Likes

C'mon, you know you want to got the whole way and setup InfluxDB and Grafana.... :wink:

Maybe one day (I'm fairly database stupid)

@jtp10181 can help you get setup easily, but that's for another topic....

1 Like