-
Notifications
You must be signed in to change notification settings - Fork 18
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
Detected blocking call to open inside the event loop #135
Comments
to add more details, HA 2024.6 adds a check for this type of file I/O happening in the event loop. Detected blocking call to open inside the event loop by custom integration 'watchman' at custom_components/watchman/utils.py, line 258: for i, line in enumerate(open(yaml_file, encoding="utf-8")): (offender: /config/custom_components/watchman/utils.py, line 258: for i, line in enumerate(open(yaml_file, encoding="utf-8")):), please create a bug report at https://github.com/dummylabs/thewatchman/issues Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/main.py", line 223, in sys.exit(main()) File "/usr/src/homeassistant/homeassistant/main.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 188, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 672, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 639, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1988, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/src/homeassistant/homeassistant/runner.py", line 164, in setup_and_run_hass return await hass.async_run() File "/usr/src/homeassistant/homeassistant/core.py", line 515, in async_run await self.async_start() File "/usr/src/homeassistant/homeassistant/core.py", line 568, in async_start self.bus.async_fire_internal(EVENT_HOMEASSISTANT_STARTED) File "/usr/src/homeassistant/homeassistant/core.py", line 1554, in async_fire_internal self._hass.async_run_hass_job(job, event) File "/usr/src/homeassistant/homeassistant/core.py", line 936, in async_run_hass_job hassjob.target(*args) File "/usr/src/homeassistant/homeassistant/core.py", line 1418, in call self.hass.async_run_hass_job(self.listener_job, event) File "/usr/src/homeassistant/homeassistant/core.py", line 939, in async_run_hass_job return self._async_add_hass_job(hassjob, *args, background=background) File "/usr/src/homeassistant/homeassistant/core.py", line 748, in async_add_hass_job task = create_eager_task( File "/usr/src/homeassistant/homeassistant/util/async.py", line 37, in create_eager_task return Task(coro, loop=loop, name=name, eager_start=True) File "/config/custom_components/watchman/init.py", line 274, in async_on_home_assistant_started parse_config(hass, reason="HA restart") File "/config/custom_components/watchman/init.py", line 351, in parse_config entity_list, service_list, files_parsed, files_ignored = parse( File "/config/custom_components/watchman/utils.py", line 258, in parse for i, line in enumerate(open(yaml_file, encoding="utf-8")): |
I am running into what I believe is the same issue. I had to actually disable the integration as this specific long section of messages keep appearing endlessly in my syslog - and also includes the statement "please create a bug report at https://github.com/dummylabs/thewatchman/issues":
|
So i'm a little worried about this, the owner of this repo has basically no commit history this year and is the only contributor .... Even if a PR was opened with a fix do we think it will be merged? |
Maybe it's the perfect moment for a fork that addresses some of the issues and takes care of some PRs. |
@Mariusthvdb @OzGav @asucrews @johntdyer I think about creating a maintained fork of this repo. Not introducing lots of new features but rather taking care of due maintenance, small fixes and ensuring it works with the next versions of HA. There's no activity in here and as @johntdyer already pointed out: this might be a sinking ship. Would be great if we could maintain that ship until maybe @dummylabs re-surfaces and takes over again. Since I don't want to end like @dummylabs and have to do it all alone and you've either contributed to this project or commented and seem to have dev and/or tech backgrounds: would anybody like to join me in realizing this? |
@andreasbrett not 100% sure what i can do, but i am willing to help out |
Sorry I am unable to commit to helping as I am busy on other projects. |
I just released a beta over on my fork. It fixes this issue. Could you please test it in your HA installations? Find the installation instructions in README and in HACS don't forget to enable "show beta versions". https://github.com/andreasbrett/thewatchman/releases/tag/v0.6.2-beta0 |
Sees to be fixed for me using your beta. Great work! |
I've also replaced the old version with your form beta 0.6.2 beta0 and it's working perfectly! Thanks @andreasbrett ! |
Thanks for picking this up! I’ll surely test drive. having said that, I am surprised I dit see these loggings… let me check more and I’ll report back edit I see I didnt have that anymore at all, simply have the manifest:
not sure why I dont get the errors mentioned above in that case.... |
Hey @Mariusthvdb could you explain which line you added where? |
Correct, as I stated above. It is no longer there. |
Thank you very much for your feedback. Unfortunately, I'm not good enough to understand everything. I don't have core 2024.6.0 or higher installed yet. Is there anything I can or must do to avoid getting the error later after the core update? |
Tbh: I am not the expert here. Important thing is that
you could check at discord dev channel ask around. |
@andreasbrett I try your beta 0.6.2 beta0 and it's working great on two systems with HA 2024.6.1 Thank you! |
@andreasbrett Tried your 0.6.2 beta0 and it fixed the issue for me. PS.: I wonder why this integration is not a standard one. |
Thank you for your response. Maybe I'll just wait a bit. @andreasbrett seems to be on the right track. Edit: Furthermore, I am even less of an expert. I am a simple user. And somewhat overwhelmed by the problem. |
Thanks @andreasbrett I swapped from dummylabs' version to your fork and installed the 0.6.2 beta0 and it fixed the issue for me. Steps I followed to move to the new version:
No reconfiguration required and all working fine |
Thank you @andreasbrett for the update to this repo and to @gcoan for the update instructions. I am using the new (experimental) HACS user interface. In order to obtain the 0.6.2 beta0 version, I had to 'redownload' the after initially switching to the new repository. 'redownload' gave me the option to enable beta versions and to select 0.6.2 beta0 version |
Yes, thank you! This is working great thanks to your time and efforts.
…On Tue, Jun 18, 2024 at 21:54 teskanoo ***@***.***> wrote:
Thank you @andreasbrett <https://github.com/andreasbrett> for the update
to this repo and to @gcoan <https://github.com/gcoan> for the update
instructions.
I am using the new (experimental) HACS user interface.
In order to obtain the 0.6.2 beta0 version, I had to 'redownload' the
after initially switching to the new repository.
'redownload' gave me the option to enable beta versions and to select
0.6.2 beta0 version
—
Reply to this email directly, view it on GitHub
<#135 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACSZYBOI7ECHGOTR3PAFQ7DZIDQHDAVCNFSM6AAAAABIQES64GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZXGM3TIMZWHE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Hey @andreasbrett, thank you for your efforts. Hopefully, I’m getting back on track and am ready to maintain this repo. Could you please create a pull request for your fix so that I can incorporate it? |
@dummylabs - thanks for coming back! |
Yep, just wanted to have proper attribution in the code. Anyway, I really appreciate the valuable contribution of @andreasbrett and other guys. Thank you! |
I just created the PR for the "blocking call" fix. |
For some strange reason, I couldn’t run it in the devcontainer with HA version 2024.6.0 because of an error message: "No module named ‘aiofiles’". However, adding it to the manifest file solved the problem. I’ll continue testing tomorrow. |
Fix is in the main branch (available in HACS as beta). The new version will be published soon. |
Should be fixed in 0.6.2. |
thx, for keeping the original watchman repo alive! |
Don’t believe it’s ready yet. I see several areas for improvement in how watchman should function, particularly:
|
well, if anything, I find the current install working very nicely! and I dread the moment you would change to creating repairs for each file Watchman finds..... maybe per category, but not per file, that would be not be a nice user experience at all, aas Ive seen moments in the config where over 70 or so files where either not used or missing etc etc.... this is one of those very useful components that probably will never be in core, so if you ask me, dont strive for that at all. Just make it better! thanks for doing so! btw a FR (will open a separate) would be to add a service to update the readings, (not create a report but actually a rerun of the component) after one has made changes on the config/yaml/recorder etc etc. we now have to reload the integration, which is not very UI friendly. Seems also not to be reliable, because after commenting an offender, it is still reported after the reload of the integration. but that is per design:
I would just like to add a button in the Dashboard and click that ;-) Additional to the default..... |
Thank you for your kind words!
Watchman listens to several events in Home Assistant and should automatically update its sensors when Home Assistant starts and when configuration parts gets reloaded via UI (YAML configuration reloading). I will check it out, may be things have changed since this feature was released. |
Sure. please also see if you can add functionality for changing recorded entities filters. thats when I noticed . |
Warning in log starting with HA 2024.6.0b1
Detected blocking call to open inside the event loop by custom integration 'watchman' at custom_components/watchman/utils.py, line 258: for i, line in enumerate(open(yaml_file, encoding="utf-8")): (offender: /config/custom_components/watchman/utils.py, line 258: for i, line in enumerate(open(yaml_file, encoding="utf-8")):), please create a bug report at https://github.com/dummylabs/thewatchman/issues
The text was updated successfully, but these errors were encountered: