From 9fdefa5a1da28ab074dddfbbf21d6636a7f2dc88 Mon Sep 17 00:00:00 2001 From: "St. John Johnson" Date: Mon, 9 Jan 2017 01:35:38 -0800 Subject: [PATCH] Fix #5188 by Closing the stream instead of Releasing it (#5235) * Fix #5188 by Closing the stream instead of Releasing it Closing just terminates the connection, release attempts to download all the contents before closing. Since the MJPEG stream is infinite, it loads and loads content until the python script runs out of memory. Source: https://github.com/KeepSafe/aiohttp/blob/50b1d30f4128abd895532022c726e97993987c7c/aiohttp/client_reqrep.py#L668-L672 * Update mjpeg.py --- homeassistant/components/camera/mjpeg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/camera/mjpeg.py b/homeassistant/components/camera/mjpeg.py index 981ed9dbf49..d3af55a91f1 100644 --- a/homeassistant/components/camera/mjpeg.py +++ b/homeassistant/components/camera/mjpeg.py @@ -126,7 +126,7 @@ class MjpegCamera(Camera): finally: if stream is not None: - self.hass.async_add_job(stream.release()) + yield from stream.close() if response is not None: yield from response.write_eof()