WebThingsIO / gateway

WebThings Gateway - a self-hosted web application for monitoring and controlling a building over the web
http://webthings.io/gateway
Mozilla Public License 2.0
2.62k stars 339 forks source link

Add-on autoupdate disables the add-on #2199

Open tssk opened 5 years ago

tssk commented 5 years ago

Hello,

I noticed that add-ons are updated automatically. But every time new add-on version is released the add-on is removed and I have to manually add it again from the list.

It seems to me that this is some kind of bug becuase it does not make sense to me. I would expect one of this behaviors:

I am using Gateway v0.9.2 on Debian 10 installed according to the procedure described in the github readme.

From the log:

Yesterday when update was released:

2019-10-01 07:47:40.071 INFO   : Checking for add-on updates...
2019-10-01 07:47:40.395 INFO   : Unloading OnvifAdapter
2019-10-01 07:47:43.901 INFO   : Fetching add-on https://github.com/mozilla-iot/onvif-adapter/releases/download/v0.2.1/onvif-adapter-0.2.1.tgz as /tmp/PDXf2d/onvif-adapter.tar.gz
2019-10-01 07:47:49.901 INFO   : Expanding add-on /tmp/PDXf2d/onvif-adapter.tar.gz into /home/safarik/.mozilla-iot/addons/onvif-adapter
2019-10-01 07:47:50.499 INFO   : Finished updating add-ons

Today when I manually added the add-on because it was missing:

2019-10-02 07:25:57.927 ERROR  : Failed to get property stream: getProperty: device: onvif-1359894 not found.
2019-10-02 07:25:57.930 ERROR  : Failed to get property snapshot: getProperty: device: onvif-1359894 not found.
2019-10-02 07:26:32.324 INFO   : Fetching add-on https://github.com/mozilla-iot/onvif-adapter/releases/download/v0.2.1/onvif-adapter-0.2.1.tgz as /tmp/KaLBTy/onvif-adapter.tar.gz
2019-10-02 07:26:38.771 INFO   : Expanding add-on /tmp/KaLBTy/onvif-adapter.tar.gz into /home/safarik/.mozilla-iot/addons/onvif-adapter
2019-10-02 07:26:39.526 INFO   : Loading add-on: onvif-adapter
2019-10-02 07:26:39.849 INFO   : onvif: Opening database: /home/safarik/.mozilla-iot/config/db.sqlite3
2019-10-02 07:26:39.874 INFO   : onvif: Loading add-on for onvif-adapter from /home/safarik/.mozilla-iot/addons/onvif-adapter
2019-10-02 07:27:07.753 INFO   : getValue for property streamActive for: CAM5 returning false
2019-10-02 07:27:45.065 INFO   : onvif: setCachedValueAndNotify for property streamActive from false to true for onvif-1359894
2019-10-02 07:28:10.096 INFO   : onvif: setCachedValueAndNotify for property streamActive from true to false for onvif-1359894
2019-10-02 07:47:40.142 INFO   : Checking for add-on updates...
2019-10-02 07:47:40.429 INFO   : Finished updating add-ons

I will be happy to provide more info or test something.

Thanks,

Tomas

mrstegeman commented 5 years ago

This is definitely not normal behavior. The add-on enablement status is maintained during updates. Here's a log from a test I just ran:

2019-10-02 08:28:03.806 INFO   : Checking for add-on updates...
2019-10-02 08:28:04.499 INFO   : Unloading VirtualThingsAdapter
2019-10-02 08:28:04.513 INFO   : virtual-things: Adapter: VirtualThingsAdapter unloaded
2019-10-02 08:28:08.025 INFO   : Fetching add-on https://github.com/mozilla-iot/virtual-things-adapter/releases/download/v0.5.1/virtual-things-adapter-0.5.1.tgz as /var/folders/1b/0pz5lkgn1ld6lmz7k6qwlyzm0000gn/T/JaXLKf/virtual-things-adapter.tar.gz
2019-10-02 08:28:29.523 INFO   : Expanding add-on /var/folders/1b/0pz5lkgn1ld6lmz7k6qwlyzm0000gn/T/JaXLKf/virtual-things-adapter.tar.gz into /Users/mstegeman/.mozilla-iot/addons/virtual-things-adapter
2019-10-02 08:28:29.699 INFO   : Loading add-on: virtual-things-adapter
2019-10-02 08:28:29.765 INFO   : Finished updating add-ons
2019-10-02 08:28:29.904 INFO   : virtual-things: Opening database: /Users/mstegeman/.mozilla-iot/config/db.sqlite3
2019-10-02 08:28:30.045 INFO   : virtual-things: Loading add-on virtual-things-adapter from /Users/mstegeman/.mozilla-iot/addons/virtual-things-adapter

Was there nothing after Finished updating add-ons in your first log?

tssk commented 5 years ago

These 5 lines are all I have in the log for that day:

2019-10-01 07:47:40.071 INFO   : Checking for add-on updates...
2019-10-01 07:47:40.395 INFO   : Unloading OnvifAdapter
2019-10-01 07:47:43.901 INFO   : Fetching add-on https://github.com/mozilla-iot/onvif-adapter/releases/download/v0.2.1/onvif-adapter-0.2.1.tgz as /tmp/PDXf2d/onvif-adapter.tar.gz
2019-10-01 07:47:49.901 INFO   : Expanding add-on /tmp/PDXf2d/onvif-adapter.tar.gz into /home/safarik/.mozilla-iot/addons/onvif-adapter
2019-10-01 07:47:50.499 INFO   : Finished updating add-ons
mrstegeman commented 5 years ago

Hmm, that's very weird. Does this only seem to happen with the ONVIF add-on, or with all add-ons?

tssk commented 5 years ago

It also happened recently with Philips Hue add-on. So I guess all of them.