-
-
Notifications
You must be signed in to change notification settings - Fork 428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Group is sometimes missing state updates from members #3578
Comments
I've seen it once today but wasn't able to reproduce it. Can you reproduce it? In that case I would like to provide a bundle for debugging that. |
It happens very very regularly, so yes I can reproduce it, even though I have no idea what is different if it works. |
Update the core bundle:
and stop openHAB, edit
After starting again you now see the thread name in column three of the output and also additional logging when
Can you post the log when the issue occurs (including about ten lines before the missed update). I see that several threads are calling |
I‘ve just switched my Switch Item
FYI, this is how it looks if it works (which it does in 1 of 100 tries currently):
|
Thanks. I added additional logging around the scheduling. Can you update (and restart) again? The additional logging is only for |
I now get the following logs:
|
So it seems they are really scheduled but not executed. I don't understand how that can happen. According to the documentation a rejected execution should result in a |
Hmm, very weird. Should I now update the bundle again and restart? |
Yes please. |
Unfortunately this did not help. What‘s really interesting is, that it works for none of my EDIT: No, it does not work for my contacts group either. EDIT: After setting the threadpool size of the
|
I am currently experimenting a bit, and setting the threadpool size to 400 seems to migitate the problem, which also is type of proof that there is some problem with threading. Reading a bit inside |
I have added some logging to the Setting the thread pool size of the |
How many tasks are scheduled for each update? And how many state updates do you see (per second)? I guess we should figure out why it takes so long to process the queue. |
For each update, at least one task for persistence is scheduled plus for each group the Item is a a member of. Most of my Items are at least member of one group, so per state update at least 2, usually 3 tasks scheduled. I cannot really say how many state updates are there per second, however my added logging tells me how many tasks are executed or queued per second: In peaks, there are over 30 messages per second. With a thread pool size of 200, there are regularly tasks queued which are executed short time later when there is less load. I have to admit that I have 900 Items and a lot of traffic, however I most aren‘t so talky (e.g. my KNX), the system info binding might be a candidate for many Item state updates in short time and very often. |
I think persistence might indeed be the problem here. The state change listener receives, checks and stores the values from the state change event in the same thread. This might block threads for a longer time and exhaust the thread pool. |
I have verified this by removing the setting for the |
That's a very tricky one. Originally my idea was to just schedule the events in the |
What if the jobs for the |
I think the "real" issue is that she JavaDoc of
is not well implemented in the persistence services. I checked at least InfluxDB and there the store operation is executes synchronously. |
So the root problem is not the core architecture but the implementation in the persistence services, right? FYI I am using InfluxDB and MapDB. |
Can you try updating the influxdb bundle with |
I wasn‘t able to use the bundle you provided, however I compiled your InfluxDB PR and deployed it, but the problem persists. It seems that it is better now. With 40 threads for the |
If it needed 900 before that's at least a factor 20 better 😀 Was that with influxdb only or did you also re-enable mapdb? |
It needed 400 before, but this means still much better. MapDB was re-enabled. |
Good news! So it is verified that MapDB is causing trouble then… |
Since it has been confirmed that this is an issue in adding, I'll close it here. |
Expected Behavior
If a member of a group changes or updates it's state, the group's StateChangeListener should get informed.
Current Behavior
Most times when a group member updates or changed its state, the group's listeners are not informed.
The weird behaviour is, that this is not always the case.
openhab-core/bundles/org.openhab.core/src/main/java/org/openhab/core/items/GenericItem.java
Lines 258 to 279 in ac0f512
I found out that:
notifyListeners
is called andclonedListeners
contains the listeners as expected.clonedListeners
pool.execute
is called.listener.stateUpdate
andlistener.stateChanged
ifstateChanged
are never called.Possible Solution
Steps to Reproduce (for Bugs)
Group:Switch:OR(ON,OFF)
Switch
ItemContext
Your Environment
The text was updated successfully, but these errors were encountered: