home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.16k stars 29.84k forks source link

Enphase Envoy detected I/O inside event loop #35061

Closed keilorca closed 4 years ago

keilorca commented 4 years ago

The problem

Enphase Envoy is generating a detected I/O inside event loop warning in log. Reporting as per v109 release notes

Environment

HA version 0.109.2

Problem-relevant configuration.yaml

Traceback/Error logs

2020-05-02 17:37:14 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue for enphase_envoy doing I/O at homeassistant/components/enphase_envoy/sensor.py, line 156: inverters = await (self._envoy_reader.inverters_production())

Additional information

probot-home-assistant[bot] commented 4 years ago

enphase_envoy documentation enphase_envoy source (message by IssueLinks)

bdraco commented 4 years ago

import requests as requests_sync

Looks legit as it is using requests_sync in that block.

On May 2, 2020, at 9:56 AM, Aaron Bach notifications@github.com wrote:

This may be a fasle positive: envoy_reader https://github.com/jesserizzo/envoy_reader makes use of requests_async https://github.com/encode/requests-async.

The offending line above points to https://github.com/jesserizzo/envoy_reader/blob/ee176190ebe95d98d6414deecf6d710438270cf9/envoy_reader/envoy_reader.py#L346-L375 https://github.com/jesserizzo/envoy_reader/blob/ee176190ebe95d98d6414deecf6d710438270cf9/envoy_reader/envoy_reader.py#L346-L375.

@balloob https://github.com/balloob, @bdraco https://github.com/bdraco, @MartinHjelmare https://github.com/MartinHjelmare: thoughts? False positive or something to fix?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/35061#issuecomment-622966550, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFB7CBREDUTRBG5FE4LSDTRPQYDNANCNFSM4MXSSQXA.

bachya commented 4 years ago

@bdraco Check out #35072. It's using sync functionality within async_setup_platform and async_update.

MartinHjelmare commented 4 years ago

The library should be fixed. It should not use sync requests inside coroutines.

gtdiehl commented 4 years ago

The library has a PR opened against it. https://github.com/jesserizzo/envoy_reader/pull/29

balloob commented 4 years ago

@gtdiehl version 0.16 has been released with your fix. Could you do a PR for HA to bump the version? It's not clear if there are any breaking changes.

gtdiehl commented 4 years ago

@balloob Another version will have to be released. I only updated the requirements.txt file, the setup.py file has to be updated as well on the envoy_reader library side. Try again with 0.16.1 jesserizzo/envoy_reader#31