8000 Try to fix Segfaults by pvizeli · Pull Request #3494 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Try to fix Segfaults #3494

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

Closed
wants to merge 1 commit into from
Closed

Conversation

pvizeli
Copy link
Member
@pvizeli pvizeli commented Sep 23, 2016

Description:

Template sensor run into endless Loop while it use force_update in a state_change callback (with MATCH_ALL):
https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/sensor/template.py#L27
https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/sensor/template.py#L81
That Trigger this in StateMachine:
https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/core.py#L776-L781
We create now a new STATE_CHANGE event and they will trigger a new force_update on entities which will create a new STATE_CHANGE event ect.

Related issue (if applicable): fixes #3453

@turbokongen
Copy link
Contributor

Tried the fix with template sensors enabled:
http://hastebin.com/avuzojafeq.vbs

@turbokongen
Copy link
Contributor

Next crash, maybe not that helpful: http://hastebin.com/ditarutaci.vbs

@pvizeli
Copy link
Member Author
pvizeli commented Sep 23, 2016

I think my fix is wrong but the bug is the same.
Edit
The fix is not wrong, but it not fix at all. We have 2 bugs

@pvizeli pvizeli changed the title Fix Segfaults Try to fix Segfaults Sep 23, 2016
@pvizeli
Copy link
Member Author
pvizeli commented Sep 23, 2016

In Traceback we see now, that the template threads now okay. But I see that now async stuff run in 2 threads...

@lwis
Copy link
Member
lwis commented Sep 23, 2016

@pvizeli do we know what specifically caused these sudden segfaults?

@pvizeli
Copy link
Member Author
pvizeli commented Sep 23, 2016

Trace bevor PR:
http://hastebin.com/toxerobunu.vbs

Trace after PR:
http://hastebin.com/ditarutaci.vbs

That is very clean as bevor but I see that is a new async Event Loop run in a new thread and I think that is the trouble. I think it is the construct of https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/sensor/template.py#L83 who make a wrong thing in this case. It run one ha_update_state() and break after what ever. I think more Analyse is needed from @bbangert I hope with I fix the first bug, we see now the second bug.

@balloob
Copy link
Member
balloob commented Sep 23, 2016

It looks to me like force_refresh and soft_update have exactly the same semantics.

Please note that force_update would be a reason why we would get into a loop, as it would write always to the state machine. However, that one does not seem to be included with templates.

< A11B /div>

@pvizeli
Copy link
Member Author
pvizeli commented Sep 23, 2016

Yeah that is true

@pvizeli pvizeli closed this Sep 23, 2016
@home-assistant home-assistant locked and limited conversation to collaborators Mar 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Random Segfaults
4 participants
0