Need to restart OH twice after upgrading daily snapshot release

Tags: #<Tag:0x00007faee5c706a0> #<Tag:0x00007faee5c70560>

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.