Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Duplicate items #5112

Open
htreu opened this issue Feb 19, 2018 · 9 comments
Open

Duplicate items #5112

htreu opened this issue Feb 19, 2018 · 9 comments

Comments

@htreu
Copy link
Contributor

htreu commented Feb 19, 2018

This is a follow up on #4565.
The original Error message is

2017-11-15 17:11:29.751 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.SwitchItem with key'Licht_Slaapkamer_Kind1' already exists! Failed to add a second with the same UID!
2017-11-15 17:11:29.754 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.SwitchItem with key'WifiAccessPointBureau' already exists! Failed to add a second with the same UID!

The initial report states that only items from the ManagedItemProvider (i.e. added through Paper UI) have this Problem.
The initial analysis pointed to a load order issue between the ChannelItemProvider (creating items for ChannelLinks from the database) and the ManagedItemProvider (loading the actual items for the former processed links).
This issue was addressed by #4580 which informs the ChannelItemProvider before another item is added to the registry, so the ChannelItemProvider can remove its temporary item.

@htreu
Copy link
Contributor Author

htreu commented Feb 19, 2018

@jowi24 can you please add some details on your report:

  • an excerpt from the log showing the exact error message
  • do only items added via Paper UI are affected?

Thanks.

@kaikreuzer
Copy link
Contributor

I have seen similar warnings in my production system and have had a closer look: In my case, I had an item with the same name within the jsondb (i.e. one that had been created once through the Paper UI) and within an items-file.
This is clearly a situation where the setup is incorrect, so the warning is all fine. I removed one of these item definitions and the warning went away as expected.

@htreu
Copy link
Contributor Author

htreu commented Feb 19, 2018

@jowi24, please also inspect your setup for the issue Kai described above.

@jowi24
Copy link

jowi24 commented Feb 19, 2018

Here is the log-extract showing the warning messages:

03:05:30.505 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.RollershutterItem with key'Wohnung_Rollo' already exists! Failed to add a second with the same UID!
03:05:30.509 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.SwitchItem with key'Smartphone_Ma_Online' already exists! Failed to add a second with the same UID!
03:05:30.536 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.SwitchItem with key'Kueche_Theke_Licht' already exists! Failed to add a second with the same UID!
03:05:30.547 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.SwitchItem with key 'Wohnzimmer_Taster4fach_Batterie' already exists! Failed to add a second with the same UID!
03:05:30.548 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.NumberItem with key'Bad_Temperatur' already exists! Failed to add a second with the same UID!
03:05:30.552 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.NumberItem with key'Keller_Luftfeuchte_Relativ' already exists! Failed to add a second with the same UID!
03:05:30.564 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.NumberItem with key'Schlafzimmer_Temperatur' already exists! Failed to add a second with the same UID!
03:05:30.589 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.NumberItem with key'Tiefkuehltruhe_Temperatur' already exists! Failed to add a second with the same UID!
03:05:30.604 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.SwitchItem with key'Smartphone_Jo_Online' already exists! Failed to add a second with the same UID!
03:05:30.607 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.SwitchItem with key'Aquarium_Licht' already exists! Failed to add a second with the same UID!
03:05:30.607 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.NumberItem with key 'Schlafzimmer_Luftfeuchte_Relativ' already exists! Failed to add a second with the same UID!
03:05:30.610 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.NumberItem with key'LocalComputer_Cpu_Load' already exists! Failed to add a second with the same UID!
03:05:30.612 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.SwitchItem with key'Kueche_Schraenke_Licht' already exists! Failed to add a second with the same UID!
03:05:30.615 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.DateTimeItem with key'Sonne_Aufgang' already exists! Failed to add a second with the same UID!
03:05:30.625 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.SwitchItem with key'HM4fachTasterWohnzimmer_1_PressLong' already exists! Failed to add a second with the same UID!
03:05:30.628 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.NumberItem with key'Aussen_Luftfeuchte_Relativ' already exists! Failed to add a second with the same UID!
03:05:30.631 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.NumberItem with key'Sonne_Hoehe' already exists! Failed to add a second with the same UID!
03:05:30.633 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.SwitchItem with key'Wohnzimmer_AVReceiver_Mute' already exists! Failed to add a second with the same UID!
03:05:30.635 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.DateTimeItem with key'Sonne_Untergang' already exists! Failed to add a second with the same UID!
03:05:30.640 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.NumberItem with key'Bad_Luftfeuchte_Relativ' already exists! Failed to add a second with the same UID!
03:05:30.645 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.SwitchItem with key'HM4fachTasterWohnzimmer_4_PressLong' already exists! Failed to add a second with the same UID!
03:05:30.647 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.DimmerItem with key'Wohnzimmer_AVReceiver_Lautstaerke' already exists! Failed to add a second with the same UID!
03:05:30.652 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.StringItem with key'UpnpRadio_Kanal' already exists! Failed to add a second with the same UID!
03:05:30.654 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.SwitchItem with key'Wohnzimmer_Fensterkontakt_Batterie' already exists! Failed to add a second with the same UID!

These items have been all added via Paper UI, no items of my item-files do appear. Also, every n-th restart or so the warnings do not appear in the log.

I also double checked that there is no item duplication of jsondb items and items from item-files, as Kai suggested.

sjsf pushed a commit to sjsf/smarthome that referenced this issue Feb 20, 2018
relates to eclipse-archived#5112, eclipse-archived#4565 and others
Signed-off-by: Simon Kaufmann <simon.kfm@googlemail.com>
@sjsf
Copy link
Contributor

sjsf commented Feb 20, 2018

One interesting observation: These are different log entries - they can be (accidentally) distinguished by the missing space character in front of the item name.

The version with the space is logged when individual items are attempted to be added to the registry:

https://github.com/eclipse/smarthome/blob/447b2d6e90f4714d4dee8e127173b5209292508f/bundles/core/org.eclipse.smarthome.core/src/main/java/org/eclipse/smarthome/core/common/registry/AbstractRegistry.java#L130-L131

The version without the space gets logged then a whole provider is added and its items are attempted to be bulk-added to the registry:

https://github.com/eclipse/smarthome/blob/447b2d6e90f4714d4dee8e127173b5209292508f/bundles/core/org.eclipse.smarthome.core/src/main/java/org/eclipse/smarthome/core/common/registry/AbstractRegistry.java#L285-L286

It is not impossible, but highly unlikely that the ManagedItemProvider (i.e. the one backed by the JSON DB) adds items individually, especially as it could create items of the same type (which are added as bulk). To me it looks like there is a high chance that another provider is involved.

Btw: I have created #5121 to make them distinguishable properly and also include the provider names for better debugging.

maggu2810 pushed a commit that referenced this issue Feb 20, 2018
* include providers in duplicate element warning

relates to #5112, #4565 and others
Signed-off-by: Simon Kaufmann <simon.kfm@googlemail.com>
@nesys
Copy link

nesys commented Mar 24, 2018

It seems I'm experiencing the same issue here. openHAB 2.3.0 build 1238. The items involved have been created via PaperUI, there are not same items in my .items files. See attached.
The workaround explained in #4565 is still working for me.
Thank you very much for your support.
log - OH.txt

@htreu
Copy link
Contributor Author

htreu commented Mar 26, 2018

Thanks for the report @nesys. I extracted the relevant part of your log:

2018-03-24 11:00:46.462 [WARN ] [ore.common.registry.AbstractRegistry] - NumberItem with key 'FridgeMeteredWallPlugSwitch_ElectricMeterWatts' already exists from provider ChannelItemProvider! Failed to bulk-add a second with the same UID from provider ManagedItemProvider!
2018-03-24 11:00:46.513 [WARN ] [ore.common.registry.AbstractRegistry] - NumberItem with key 'NetatmoKitchen_HeatIndex' already exists from provider ChannelItemProvider! Failed to bulk-add a second with the same UID from provider ManagedItemProvider!
2018-03-24 11:00:46.520 [WARN ] [ore.common.registry.AbstractRegistry] - SwitchItem with key 'DryerMeteredWallPlugSwitch_ResetTheTotalPowerConsumption' already exists from provider ChannelItemProvider! Failed to bulk-add a second with the same UID from provider ManagedItemProvider!
2018-03-24 11:00:46.522 [WARN ] [ore.common.registry.AbstractRegistry] - NumberItem with key 'NetatmoBedroom_Humidity' already exists from provider ChannelItemProvider! Failed to bulk-add a second with the same UID from provider ManagedItemProvider!
2018-03-24 11:00:46.529 [WARN ] [ore.common.registry.AbstractRegistry] - NumberItem with key 'NetatmoLivingRoom_HeatIndex' already exists from provider ChannelItemProvider! Failed to bulk-add a second with the same UID from provider ManagedItemProvider!

@htreu
Copy link
Contributor Author

htreu commented Mar 26, 2018

@SJKA we have to rethink the ChannelItemProvider logic.

@thedannymullen
Copy link

It appears mine shows up when I have multiple channels sited on a given item.

Dimmer Girls "Girls" (AllLights,gk_bedroom) [ "Switchable" ] { channel="tradfri:0220:mygateway:myColorTempBulb1:brightness" , channel="tradfri:0220:mygateway:myColorTempBulb2:brightness"}

Any help would be appreciated. I tried the work around sited in the other bug report, but it does not work for me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants