Luup restart and losing values

I’m having an issue where, over night, a few of my Vera objects are losing their values. Specifically, two virtual switches and a variable container (via plugins). The system monitor plugin shows that I’m getting a Lua restart between 2-3am.

The two virtual switches that are having trouble are ones that track awake/asleep for my wife and me. I’ve checked them before going to sleep and they correctly reflect that Vera knows we’re going to sleep. When I wake up, the value is reversed, thinking we’re awake.

I’ve attached a notification to these virtual switches and it looks like Vera sees the ones that are set intentionally, but not the phantom reset.

Additionally, a variable container that I set at 12:30am reverts back to its values from the previous day.

I have some PLEG code that watches the awake/asleep virtual switches and PLEG doesn’t see the switch from off to on that occurs during the night, either.

System monitor typically shows that I’ve got ~24148k memory available.

I don’t have anything scheduled to happen around the time of the reset. I suspect it’s the nightly heal.

Any pointers or suggestions?

The latest version of PLEG should see the changes that are made during the Restart.

Actually, I believe the issues started the day I updated to the latest version of PLEG. And it’s definitely not seeing the change. When I checked the status of “asleep”, the timestamp was from the previous day despite the fact that I had confirmed that Vera showed that I had set the virtual switch. So when I checked on Friday morning, it said that the last time I set the “awake” virtual switch was on Wednesday.

Check your LuaUPnP.log file to see if you have any entries that contain WriteUserData failed. This would indicate that Vera is unable to save the latest UserData so, on a restart, you will get the last set it did manage to save. If you are getting this error, it may occur every six minutes. I believe it indicates that there is insufficient free flash memory available to store the file.

In my case, I fixed it by uninstalling some non-essential plugins and deleting their files from /etc/cmh-ludl before restarting Vera. Then I ordered a Vera 3…

I am seeing that! Yikes.

So, uninstalling a plugin leaves files in cmh-ludl, huh? I see some files from several old plugins that I’ve uninstalled.

Is deleting them from that directory the best way to clean 'em out? I’d just delete, then reboot?

I guess it’s also time to move logs to USB…

Is deleting them from that directory the best way to clean 'em out? I'd just delete, then reboot?
I don't know about [i]best[/i] but it works. Just be sure you have uninstalled the plugin in [b]Vera, APPS[/b] otherwise it will try to help by downloading the files for you again. ;D
I guess it's also time to move logs to USB...
Yup - that's a big help too.

You may want to check (via SSH) what free memory you really do have.
System monitor shows mine at 28400k but when I log in it’s actually looks to be 5432k.

I’ve been unable to save changes or delete things for weeks due (I think) to insufficient resources

[quote=“parkerc, post:7, topic:178012”]You may want to check (via SSH) what free memory you really do have.
System monitor shows mine at 28400k but when I log in it’s actually looks to be 5432k.[/quote]

Yeah. “free” reports ~6-7k. I guess “System Monitor” may be the next plugin I remove…

EDIT: In practice, it looks like I run around 2-3k “free”

The error in the logs says:

UserData::WriteUserData failed File Size: 63200 save size 62846

Then later:

11/29/13 14:20:30.992 UserData::WriteUserData failed File Size: 63282 save size 0
11/29/13 14:20:31.290 UserData::WriteUserData failed File Size: 63315 save size 0

It looks like the file size gets gradually bigger. Is that normal? Or a leak?

[quote=“RexBeckett, post:6, topic:178012”]

I guess it’s also time to move logs to USB…

Yup - that’s a big help too.[/quote]

I’ve moved logs successfully. Is there anything I need to do to free up the space that the logs were previously using?

I've moved logs successfully. Is there anything I need to do to free up the space that the logs were previously using?
A full reboot (power-cycle) should reclaim it all.
It looks like the file size gets gradually bigger. Is that normal? Or a leak?
I saw the same thing on mine. I concluded it was normal behavior. If you want to check up on whether userdata is being saved OK, open up [b]/etc/cmh[/b] with WinSCP. You should see a stack of files named [b]user_data.json.lzo, user_data.json.lzo.1 ... user_data.json.lzo.5[/b]. If Vera is ticking over happily, they will have [i]Changed[/i] times six minutes apart and the top one will be within six minutes of now. On mine, the file sizes fluctuate up and down around a similar size.
I guess "System Monitor" may be the next plugin I remove...
I reached a similar conclusion. I think Vera's dependence on free memory is more complex than SystemMonitor would suggest.

@RebBeckett - thanks for all of the guidance. I changed several things: removed unused plugins, removed unused scenes, moved logs to USB.

It looks like I’m OK so far. The true test will be to see how things look when I wake up in the morning, since the awake/asleep virtual switches have been the biggest symptom of my issues.

The user_data files are currently spaced out at 6 min. So far so good!

The user_data files are currently spaced out at 6 min. So far so good!
In that case, I believe you should be [i]out of the woods[/i]. Anytime I make any significant changes, I watch the [i]user_data.json.lz[/i] stack to make sure it is still ticking away. As long as user-data is getting saved, a restart will have access to the latest data.

I’m digging around in the hope that I can find some parameter or combination that indicates the true state of Vera’s available flash. If I do, I’ll figure-out how best to display it.

Woke up this morning and everything was working as expected! Yay!

I did notice yesterday, while watching the user_data_json files - occasionally the system would take longer than 6 min - maybe once every hour and a half - and take maybe 10 or 15 min, then go back to every 6 min. Did you come up with 6 from perusing code or from observing behavior.

Since everything is working as expected, I’m going to decide (regardless of reality) that in those longer periods, no data is changing, so the files aren’t updated.

I have not yet found the code that performs the backup of userdata. The six minutes is observed behavior and seems, on mine, to be predictable. I would check that you are not getting any write errors during the periods when the heartbeat slows otherwise is is probably of no concern. It may be, as you suggest, that Vera only makes a backup if something changed.

Updates to the user_data file are a side effect of doing luup.variable_set this is Vera’s persistent database.

So does some cron script check every six minutes if userdata has changed and, if so, pushes a new backup onto the stack? Mine seems as regular as clockwork but then I have a lot of PLEG and other plugins doing stuff all the time. Whatever the process, it works just fine as long as you don’t run out of flash capacity…

I guess they do … I never looked that closely … I wonder if it dump’s it’s brains before it does a shutdown (reload/crash).
Is the 6 minute some interval from startup time ?

I wonder if it dump's it's brains before it does a shutdown (reload/crash).
Yes it does try to do this. If it fails due to lack of available storage or, presumably some other issue, it reloads from the last successful dump.
Is the 6 minute some interval from startup time ?
So it would appear but there is also some adjustment to the interval at 00:00.

I had the WriteUserData fails kick back in last night!

I’ve removed another plugin - one I liked, but decided wasn’t essential.

What command should I run to see how much disk space Vera has to save data? Is there something to look for in the output from df? Or is “free” going to tell me the info I need?

Are any of y’all using a Vera Lite? Maybe I’m expecting too much of it. I’m getting frustrated.

Tomorrow, plan to refactor my PLEGs so that I don’t have as many. I’ve got 11 right now.

Thank you to the user who pointed me to this thread. Pretty sure I have the same issue going on with my VeraLite.

How do I see and clear these LOG files? I have store log to USB checked and thankfully this is in the last version that loads each time, but anything new I do or change to vera doesn’t save. I’m also getting failed to download plugin, but that’s been an older error. Everything worked so I left it alone, have had this awhile, could ad devices etc… but very rookie vera user here. How would I go about opening a ticket? When I click setup, I don’t see tech support like website says I should?

Thanks everyone,
-Steve