4.0.1: Cannot delete or modify things that are provisioned from file

IMO the GenericThingProvider should be rewritten as pure Java class. It should

  1. generate a collection of UIDs for all things that are in the cache for this model
  2. parse the model and generate all things in a new collection
  3. for all things in the collections from step 2 check if the UID is already in the collection of step 1
    – if present: check if things are equal, if not, replace the thing in cache, remove UID from the collection of step 1 and notify listeners about updated thing, otherwise do nothing (prevent unnecessary updates)
    – if not present: add thing to cache, notify listeners about added thing
  4. for all UIDs still present in the collection from step 1: remove from cache, notify listeners about removed thing

IMO we should also enable strict validation: in case of any error, remove and ignore the model in total. Since in that case probably a lot of things are missing, it is more obvious to those that don’t look at logs.

Looks like even deleting the .things file doesn’t always remove things from the system, so I will need to keep stopping OH, clearing cache, starting OH whenever I make changes to things. :person_shrugging: If there just be some log telling me why it is not working…

Thanks. I’m reading your description and it seems like there is an issue in how OH handles things. Has this handling changed from OH3 to OH4 (even slightly), as this issue started after upgrading to OH4?

Regarding validation, people in this thread who believe there is another file, or a validation error in my things file is making incorrect assumptions as there are no other things files, and there are no validation errors (unless there are hidden errors OH isn’t logging), and that exact same things file worked fine on OH3, and also works on OH4 - just the things are not getting updated/removed in OH4.

I’ve provided all the details I can think of, so is there something more I could provide or try to do, or shall we consider this one as too difficult issue to investigate and fix?

If it can be reproduced without fancy docker stuff and moving files back and forth it should be possible to find and fix it.

You can confirm that your things file above and the http binding show the issue?

1 Like

Attached is a video of how it behaves, there is something triggering the issue as after a certain point, it fails to refresh items. I couldn’t repro it just with the HTTP binding, but as soon as I threw in some other thing definition, issue started.

Video: https://1drv.ms/v/s!AiTYXZ3f7ZUnjOJvblLnZ4nMzKbfng?e=HJNoK3

The exact things I used for testing so you can test if it repros for you. I recommend following my steps exactly as you might not see the issue if you just throw in the definitions and comment them out/in.

Thing http:url:A20TEST "A20TEST" [ baseURL="#" ]
Thing http:url:A21TEST "A21TEST" [ baseURL="#" ]

Thing astro:sun:home20 [ geolocation="62.161874,22.139727000000004", interval=60 ]
{
    Channels:
        Type start : rise#start [
            offset=30
        ]
        Type rangeEvent : rise#event [
            offset=30
        ]

        Type start : set#start [
            offset=-20
        ]
        Type rangeEvent : set#event [
            offset=-20
        ]
}

See Fix GenericThingProvider by J-N-K · Pull Request #3779 · openhab/openhab-core · GitHub

The important part was “things from two bindings in one file”.

3 Likes

Thank you for taking my report seriously and fixing the issue.

I recently upgraded to 4.0.2. When I saved an item or rule file in OH3 the frontail logviewer would say it was reloading and say there were errors if there were any. I no longer see anything in frontail. I’m trying to remove/add things to my sitemap. The File saves, but the sitemap doesn’t change.

Yea, the fix will be in some future version of OH, not sure which exactly.

It may be in 4.0.3 but honestly I cannot confirm 100% because I have not tested it yet.

Seems to be working better on 4.1 milestone. Some strange issues when saving files, though, getting intermittent permission denied messages on the text editor. Not sure if it is due to milestone issues…