Constant "Device already exists" error alert poup

I logged onto my local emonpi this morning and the Inputs page is broken - it constantly pops up with a series of alerts (as in the window.alert() popups that interrupt everything you’re doing). The alerts say:

“emon says: There was an error creating device: nodeid=emonpi message=Device exists”
“emon says: There was an error creating device: nodeid=emontx1 message=Device exists”
“emon says: There was an error creating device: nodeid=emonth5 message=Device exists”
“emon says: There was an error creating device: nodeid=kitchen_jk message=Device exists”
“emon says: There was an error creating device: nodeid=hotwater_jk message=Device exists”

And then repeats infinitely.

I don’t think anything changed since I was in there last (maybe last week?). I’ve been into the Admin section and done a Full Upgrade (unless I missed it in the upgrade log, there was nothing to upgrade).

My versions from the Admin page are:

Version: low-write 10.1.13
Git:
URL : GitHub - emoncms/emoncms: Web-app for processing, logging and visualising energy, temperature and other environmental data
Branch : * stable
Describe : 10.1.11-7-g90f39158

OS: Linux 4.14.71-v7+

Any idea how I can fix this please?

Thanks
John

Yes I see this too for no apparent reason.

A real pain. I thought I’d raised it here or on GitHub, but can’t see it.

Hello John, the quick fix for this is to flush redis, you can do this from the admin interface here:

or via command line: $ redis-cli flushall

I havent quite got to the bottom of what’s causing this issue to arise in the first place, the cache is essentially becoming out of sync with the mysql database. Clearing the cache to force a reload sorts it for now.

2 Likes

@TrystanLea, it does keep coming back for some reason.

1 Like

I’ve noticed this error happens after every power interruption (of which we have had 3 or 4 a week here lately!). I’m not sure if you also end up with lots of invalid inputs as well assuming you can get out of the error loop. I follow @TrystanLea advice and remove invalid inputs followed by Redis flush. Not a cure, but now easily managed. In the interim I am putting together a UPS for the rPi…

Thanks @TrystanLea that fixed it :+1:

One odd thing, there is now a new category of inputs called “18” with inputs 1…22 plus “rssi”

My emontx1 seems to have added inputs named 13…18 also.

I’d be interested to see if it comes back.

I have raised an issue as I got another one :frowning_face:

https://github.com/emoncms/emoncms/issues/1485

I havn’t had it reoccur, but as a temporary fix you could add a crontab schedule to do the command line reset?

I could, but I’d rather see a fix. It is just irritating more than anything else.

I just had this happen after a power outage. The power outage happened just before vacation/holiday what a PITA!

Anyway, I had this issue. After doing a flush, it duplicated the input from emonhub. Unfortunately I had a bunch of processing on those inputs. I used an sql client to update the new feeds with the processing rules. However, when I started the app I had the same issue and when I flushed redis again, it created the inputs again.

I ended up using the client command to flush before restarting the redis, redis-server, apache2 and emonhub services. This time it took.

I wonder whether it would hurt to put the redis-cli flushall command in to the apache2 script prior to starting apache?

Also, I don’t know what issues it might create, but I also wondered about making the fields, name & nodeid (and maybe userid?) unique?

I find forcing a reload of the web UI works for me. It is very annoying though. What I think is that it is an error on the display page rather than an underlying issue. Flushing REDIS should not cause the inputs to be recreated.