Skip to content

Fix race in entity_platform.async_add_entities#19222

Merged
balloob merged 1 commit intohome-assistant:devfrom
emontnemery:async_add_entities_race
Dec 14, 2018
Merged

Fix race in entity_platform.async_add_entities#19222
balloob merged 1 commit intohome-assistant:devfrom
emontnemery:async_add_entities_race

Conversation

@emontnemery
Copy link
Copy Markdown
Contributor

@emontnemery emontnemery commented Dec 12, 2018

Description:

There is a race in entity_platform.async_add_entities() which makes the check for duplicated entity_id fail. This in turns may cause several entities to be created with the same entity_id.
The issue can very easily be reproduced by publishing two persistent MQTT discovery messages with same name before starting hass, one of which has unique_id set.

This is a follow-up to #18445, now also fixing the case for entities which are added to the device registry.

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.

@emontnemery emontnemery requested a review from a team as a code owner December 12, 2018 15:25
@homeassistant homeassistant added cla-signed core small-pr PRs with less than 30 lines. labels Dec 12, 2018
@ghost ghost assigned emontnemery Dec 12, 2018
@ghost ghost added the in progress label Dec 12, 2018
@emontnemery emontnemery added this to the 0.84.2 milestone Dec 14, 2018
@emontnemery emontnemery requested a review from Kane610 December 14, 2018 06:54
@balloob balloob merged commit 7a7c2ad into home-assistant:dev Dec 14, 2018
@ghost ghost removed the in progress label Dec 14, 2018
@balloob balloob mentioned this pull request Dec 14, 2018
@emontnemery emontnemery deleted the async_add_entities_race branch December 19, 2018 18:59
dshokouhi pushed a commit to dshokouhi/home-assistant that referenced this pull request Dec 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants