[aiohttp.server] Error handling request

Hi all,

Since some time I am experiencing severe issues with viewing my cams in Home Assistant. I am not exactly sure when it started. I guess since the update to 2021.3.4, but i might be wrong.

Below is my (pretty simple) straight forward cam configuration.

- name: Achtertuin
  platform: generic
  still_image_url: http://192.168.0.12/Streaming/channels/1/picture
  stream_source: !secret HIKVISION_STREAMSOURCE_ACHTERTUIN
  username: admin
  password: <<left out>>

- name: Voordeur
  platform: generic
  still_image_url: http://192.168.0.13/Streaming/channels/1/picture
  stream_source: !secret HIKVISION_STREAMSOURCE_VOORDEUR
  username: admin
  password: <<left out>>

The first hour after a HASS reboot, everything is fine. Cam images are displayed in HASS (refreshed every second or so). This worked. fine for the past years. An hour after reboot, these errors start to appear in the log:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 56, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 71, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 129, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 129, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 496, in get
    return await self.handle(request, camera)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 531, in handle
    return await camera.handle_async_mjpeg_stream(request)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 396, in handle_async_mjpeg_stream
    return await self.handle_async_still_stream(request, self.frame_interval)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 386, in handle_async_still_stream
    return await async_get_still_stream(
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 197, in async_get_still_stream
    await write_to_mjpeg_stream(img_bytes)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 178, in write_to_mjpeg_stream
    await response.write(
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_response.py", line 470, in write
    await self._payload_writer.write(data)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/http_writer.py", line 107, in write
    self._write(chunk)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/http_writer.py", line 67, in _write
    raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport

These error messages continue to appear in my log for around 18 hours. Then they stop appearing, but instead i get these:

2021-03-30 11:48:59 ERROR (MainThread) [homeassistant.components.generic.camera] Timeout getting camera image from Achtertuin
2021-03-30 11:49:09 ERROR (MainThread) [homeassistant.components.generic.camera] Timeout getting camera image from Voordeur
2021-03-30 11:49:19 ERROR (MainThread) [homeassistant.components.generic.camera] Timeout getting camera image from Achtertuin
2021-03-30 11:49:29 ERROR (MainThread) [homeassistant.components.generic.camera] Timeout getting camera image from Voordeur

Obviously there is nothing wrong with the cameras itself, even though i tried restarting them.
There is not much online i can find about this. I am at the point of re-installing everything.
Maybe someone here has a good suggestion?

Same result here:


File "/usr/local/lib/python3.8/site-packages/aiohttp/http_writer.py", line 67, in _write
    raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport

Some explanation: Cannot write to closing transport