Skip to content

Commit

Permalink
Remove uvloop from default install and warn about stream+shell_command (
Browse files Browse the repository at this point in the history
home-assistant#25929)

* Add warning about uvloop and shell_command

* Remove uvloop from docker files"

* Add ffmpeg
  • Loading branch information
balloob authored Aug 15, 2019
1 parent 6d1d953 commit 9b3aa9b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ RUN virtualization/Docker/setup_docker_prereqs
# Install hass component dependencies
COPY requirements_all.txt requirements_all.txt
RUN pip3 install --no-cache-dir -r requirements_all.txt && \
pip3 install --no-cache-dir mysqlclient psycopg2 uvloop==0.12.2 cchardet cython tensorflow
pip3 install --no-cache-dir mysqlclient psycopg2 cchardet cython tensorflow

# Copy source
COPY . .
Expand Down
22 changes: 21 additions & 1 deletion homeassistant/components/stream/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

import voluptuous as vol

try:
import uvloop
except ImportError:
uvloop = None

from homeassistant.auth.util import generate_secret
import homeassistant.helpers.config_validation as cv
from homeassistant.const import EVENT_HOMEASSISTANT_STOP, CONF_FILENAME
Expand Down Expand Up @@ -38,7 +43,7 @@
vol.Optional(CONF_LOOKBACK, default=0): int,
}
)

DATA_UVLOOP_WARN = "stream_uvloop_warn"
# Set log level to error for libav
logging.getLogger("libav").setLevel(logging.ERROR)

Expand All @@ -49,6 +54,21 @@ def request_stream(hass, stream_source, *, fmt="hls", keepalive=False, options=N
if DOMAIN not in hass.config.components:
raise HomeAssistantError("Stream integration is not set up.")

if DATA_UVLOOP_WARN not in hass.data:
hass.data[DATA_UVLOOP_WARN] = True
# Warn about https://github.com/home-assistant/home-assistant/issues/22999
if (
uvloop is not None
and isinstance(hass.loop, uvloop.Loop)
and (
"shell_command" in hass.config.components
or "ffmpeg" in hass.config.components
)
):
_LOGGER.warning(
"You are using UVLoop with stream and shell_command. This is known to cause issues. Please uninstall uvloop."
)

if options is None:
options = {}

Expand Down
2 changes: 1 addition & 1 deletion virtualization/Docker/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RUN virtualization/Docker/setup_docker_prereqs
COPY requirements_all.txt requirements_all.txt

RUN pip3 install --no-cache-dir -r requirements_all.txt && \
pip3 install --no-cache-dir mysqlclient psycopg2 uvloop==0.12.2 cchardet cython
pip3 install --no-cache-dir mysqlclient psycopg2 cchardet cython

# BEGIN: Development additions

Expand Down

0 comments on commit 9b3aa9b

Please sign in to comment.