I’m running OH2.5 snapshot releases on RPi3B+ (openhabian) for some while now.
What I noticed since a couple weeks (can’t remember when it started), is that right after upgrading, not all Items are read after starting. I always must perform a second restart for all my items to appear.
This is easily visible when trying to view my sitemap in e.g. the OH app. I then get uninitialised items displayed and the openhab.log file gets filled with lines like:
2019-07-11 12:40:00.942 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Text
2019-07-11 12:40:00.950 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘DBG_DebugMode’ for widget org.eclipse.smarthome.model.sitemap.Text
Here’s my upgrade procedure:
# 1. Display OH logging (background process):
openhab-cli showlogs &
# 2. Stop OH before upgrading
sudo systemctl stop openhab2
# 3. Perform updates and remove unneeded packages (happens occasionally)
sudo apt update
apt list --upgradable -a
sudo apt upgrade -y
sudo apt autoremove
# 4. Clean the OP cache folder and reset OH file ownerships:
sudo openhab-cli clean-cache
sudo openhab-cli reset-ownership
sudo systemctl start openhab2
# 5. And after a while...
sudo systemctl restart openhab2
I can’t find an explanation why OH doesn’t load all items files after steps 1→4.
I had logged an issue about this a while back. I closed it because I was unable to reproduce it in recent snapshots. I believe I opened it in openhab-core.
jimtng
(jimtng)
March 27, 2021, 1:19am
3
I still need to restart when changing openhab versions, e.g. 3.1M2 to 3.1 snapshot, or from snapshot to snapshot, or when downgrading from snapshot to M2.
Using docker:
docker-compose pull
docker-compose up -d # the first start up
# wait a few minutes
docker-compose restart # this shouldn't be needed
rossko57
(Rossko57)
March 27, 2021, 9:53am
4
Yes. Upgrading destroys the system cache (rightly). Some configurations don’t manage a clean load without a functional cache. By the second load, the cache has been repopulated.
Sounds like a bug. OH should delay loading configurations until the cache is repopulated.
1 Like
rossko57
(Rossko57)
March 28, 2021, 3:41pm
8
This is fairly long-running business,it’s not as easy as you might think.
opened 11:46AM - 22 Jul 16 UTC
enhancement
Core
Hi all,
in our project we have a lot of event subscribers and registry change l… isteners implemented which are called during startup / shutdown of ESH as a matter of course. In shutdown phase these services will update their model accordingly which results in the problem that the model cannot be re-built after next startup (because the subscribers / listeners have been assumed that the item / thing / link has been really deleted). We should distinguish between event sending / listener notification for adding / removal of items / things / links **during framework startup / shutdown phase and normal runtime.**
For this reason I would like to disable in our project that events are sent / listeners are notified during startup / shutdown. I could imagine two ways to implement this:
1. Providing a `RuntimeStateService` that can be requested in order to get the information if the runtime is started. So for the beginning the service would only consist of a single operation `boolean : isStarted()` and it will be injected as dynamic dependency into the registries (things, items, links, rules). Then I would skip sending events / notification if the service is present and the runtime / framework is not fully started.
2. Each service that requires the runtime state has to implement a `RuntimeStateListener` interface which is tracked by a central `RuntimeStateService` to be provided by solutions based on ESH. As soon as the runtime state has changed to started the service will inform all listeners about this. Once the runtime left the started state again all listeners are informed about this. For the beginning I will implement the new RuntimeStateListener interface by the AbstractRegistry (concrete registries can decide if the runtime state listener is to be provided as a service).
I think that 2 is the only valid option to implement this requirement. In 1 the runtime state service could unregister too early so that the events are sent / listeners are notified again.
What do you think?
opened 11:04AM - 10 May 20 UTC
closed 12:14PM - 28 Nov 20 UTC
I've tried turning this into a PR but failed cross repos. Not my day today I gue… ss.
Script needs to be placed in /var/lib/openhab2/etc/scripts and will execute on Karaf startup.
I've validated and included this with [openHABian](https://github.com/mstormi/openhabian/blob/patch-1/includes/start-level.script) already.
Source https://community.openhab.org/t/cleaning-up-the-startup-process-renaming-rules-windows-possible/38438/52
Signed-off-by: Markus Storm markus.storm@gmx.net
1 Like
I just looked at the first Issue. That was before OSGi had start level ordering.
Issue 2 looked to be about OS start levels rather that OSGi ones.
EDIT: What OSGi Level does OH 3 support? I think v8 is current and start levels have been there since v7.