GithubHelp home page GithubHelp logo

Comments (13)

hllhll avatar hllhll commented on June 24, 2024

Finally saw this myself, might be misuse/mixup of threads & Async... hope to check this soon

from homeassistant-ekon-local.

hllhll avatar hllhll commented on June 24, 2024

This might be the issue...
https://github.com/hllhll/pyekonlib/blob/eb1424a0c9242be02f5bc16399f210f8b722f510/pyekonlib/Server.py#L84
Calls self._createAsyncTaskFn which maps to hass.async_create_task in https://github.com/hllhll/HomeAssistant-ekon-local/blob/master/custom_components/ekon-local/climate.py#L161 which should be used to create async task from async. for thread we should use this(?)

from homeassistant-ekon-local.

hllhll avatar hllhll commented on June 24, 2024

Please try with this fix and report back if you can...

from homeassistant-ekon-local.

leranp avatar leranp commented on June 24, 2024

Please try with this fix and report back if you can...

no problem , I will update you soon

from homeassistant-ekon-local.

hllhll avatar hllhll commented on June 24, 2024

Got a report from one user that so far, problem doesn't persist after the fix :)

from homeassistant-ekon-local.

leranp avatar leranp commented on June 24, 2024

Got a report from one user that so far, problem doesn't persist after the fix :)

it took time, but unfortunately the problem appear after 18 hour :-(

2020-12-13 18:34:19 DEBUG (MainThread) [custom_components.ekon-local.climate] EkonLocalClimate.update_state
2020-12-13 18:34:19 INFO (MainThread) [custom_components.ekon-local.climate] hvac_mode(): off
2020-12-13 18:34:19 INFO (MainThread) [custom_components.ekon-local.climate] current_temperature(): 24.0
2020-12-13 18:34:19 INFO (MainThread) [custom_components.ekon-local.climate] target_temperature(): 25.0
2020-12-13 18:34:19 INFO (MainThread) [custom_components.ekon-local.climate] fan_mode(): 1
2020-12-13 18:34:19 INFO (MainThread) [custom_components.ekon-local.climate] name(): ekon3365
2020-12-13 18:34:19 DEBUG (MainThread) [custom_components.ekon-local.climate] Ekon HVAC data recived - update scheduled
2020-12-13 18:34:24 DEBUG (MainThread) [custom_components.ekon-local.climate] Ekon HVAC data recived - Scheduling update
2020-12-13 18:34:24 DEBUG (MainThread) [custom_components.ekon-local.climate] EkonLocalClimate.update_state
2020-12-13 18:34:24 INFO (MainThread) [custom_components.ekon-local.climate] hvac_mode(): off
2020-12-13 18:34:24 INFO (MainThread) [custom_components.ekon-local.climate] current_temperature(): 24.0
2020-12-13 18:34:24 INFO (MainThread) [custom_components.ekon-local.climate] target_temperature(): 25.0
2020-12-13 18:34:24 INFO (MainThread) [custom_components.ekon-local.climate] fan_mode(): 1
2020-12-13 18:34:24 INFO (MainThread) [custom_components.ekon-local.climate] name(): ekon3365
2020-12-13 18:34:24 DEBUG (MainThread) [custom_components.ekon-local.climate] Ekon HVAC data recived - update scheduled
2020-12-13 18:34:35 DEBUG (MainThread) [custom_components.ekon-local.climate] Ekon HVAC data recived - Scheduling update
2020-12-13 18:34:35 DEBUG (MainThread) [custom_components.ekon-local.climate] EkonLocalClimate.update_state
2020-12-13 18:34:35 INFO (MainThread) [custom_components.ekon-local.climate] hvac_mode(): off
2020-12-13 18:34:35 INFO (MainThread) [custom_components.ekon-local.climate] current_temperature(): 24.0
2020-12-13 18:34:35 INFO (MainThread) [custom_components.ekon-local.climate] target_temperature(): 25.0
2020-12-13 18:34:35 INFO (MainThread) [custom_components.ekon-local.climate] fan_mode(): 1
2020-12-13 18:34:35 INFO (MainThread) [custom_components.ekon-local.climate] name(): ekon3365
2020-12-13 18:34:35 DEBUG (MainThread) [custom_components.ekon-local.climate] Ekon HVAC data recived - update scheduled
2020-12-13 18:34:43 ERROR (MainThread) [root] Uncaught exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 320, in <module>
    sys.exit(main())
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 312, in main
    exit_code = runner.run(runtime_conf)
  File "/usr/src/homeassistant/homeassistant/runner.py", line 133, in run
    return asyncio.run(setup_and_run_hass(runtime_config))
  File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 603, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 570, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1812, in _run_once
    handle = heapq.heappop(self._scheduled)
RuntimeError: list changed size during iteration```

from homeassistant-ekon-local.

leranp avatar leranp commented on June 24, 2024

python/asyncio#258

Look like the same problem here

from homeassistant-ekon-local.

hllhll avatar hllhll commented on June 24, 2024

Why di you think it's necessarily this?
I guess this situatuon might arise from multiple different issue origins.

BTW Do u might have other integration that is async based+threads? That might be due to a conflict originated from a different integration...

from homeassistant-ekon-local.

hllhll avatar hllhll commented on June 24, 2024

I have installed another integration for my ha
It seem to happen more often.
I assume that having more integrations gives the random-by-nature race condition more chances to occur...

from homeassistant-ekon-local.

hllhll avatar hllhll commented on June 24, 2024

With the help of a friend, We might have found the issue and fixed it in hllhll/pyekonlib@96d923a and corresponding fix in 0c0b2a9

from homeassistant-ekon-local.

hllhll avatar hllhll commented on June 24, 2024

I Had this issue again, not sure if it's related to my integration, so I'm re-opening it for the meantime
I plan to implement verbose logging in pyekonlib ...

from homeassistant-ekon-local.

hllhll avatar hllhll commented on June 24, 2024

Let's see if this helps ...
429cc3a
This is not ideal, because it actually creates another-mostly idle OS thread, but that's my temporary way to circumvent this issue

from homeassistant-ekon-local.

hllhll avatar hllhll commented on June 24, 2024

The way of implementation for a fix for this in pyekonlib, is not the best.
If someone could go over the code and find the actual issue, I'd like that :)
But when using commit 429cc3a This does not happen again.

from homeassistant-ekon-local.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.