Client exceeded max pending messages [2]: 512

Can someone tell me how to find out how this happen?

2019-10-10 18:59:43 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 162, in async_run
    await self._handle_action(action, variables, context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 246, in _handle_action
    await self._actions[_determine_action(action)](action, variables, context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 329, in _async_call_service
    context=context,
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 98, in async_call_from_config
    domain, service_name, service_data, blocking=blocking, context=context
  File "/usr/src/homeassistant/homeassistant/core.py", line 1209, in async_call
    raise ServiceNotFound(domain, service) from None
homeassistant.exceptions.ServiceNotFound: Unable to find service script/appletv_control_playing
2019-10-10 20:19:44 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1801182992] Client exceeded max pending messages [2]: 512
2019-10-10 20:19:44 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1801182992] Client exceeded max pending messages [2]: 512
2019-10-10 20:19:44 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1801182992] Client exceeded max pending messages [2]: 512
2019-10-11 08:33:14 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 40, in real_ip_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 231, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 128, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/http.py", line 37, in get
    return await WebSocketHandler(request.app["hass"], request).async_handle()
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/http.py", line 199, in async_handle
    await self._writer_task
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/http.py", line 66, in _writer
    await self.wsock.send_json(message, dumps=JSON_DUMP)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_ws.py", line 296, in send_json
    await self.send_str(dumps(data), compress=compress)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_ws.py", line 283, in send_str
    await self._writer.send(data, binary=False, compress=compress)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/http_websocket.py", line 643, in send
    await self._send_frame(message, WSMsgType.TEXT, compress)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/http_websocket.py", line 620, in _send_frame
    await self.protocol._drain_helper()
  File "/usr/local/lib/python3.7/site-packages/aiohttp/base_protocol.py", line 81, in _drain_helper
    await waiter
  File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 883, in _write_ready
    n = self._sock.send(self._buffer)
BrokenPipeError: [Errno 32] Broken pipe
2019-10-11 08:33:14 ERROR (MainThread) [aiohttp.server] Unhandled exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 447, in start
    await resp.prepare(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_response.py", line 353, in prepare
    return await self._start(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_response.py", line 667, in _start
    return await super()._start(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_response.py", line 410, in _start
    await writer.write_headers(status_line, headers)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/http_writer.py", line 112, in write_headers
    self._write(buf)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/http_writer.py", line 67, in _write
    raise ConnectionResetError('Cannot write to closing transport')
ConnectionResetError: Cannot write to closing transport
2019-10-11 08:51:00 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1800012112] Client exceeded max pending messages [2]: 512
2019-10-11 08:51:00 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1800012112] Client exceeded max pending messages [2]: 512 

I’ve seen this in another topic.
Don’t know if that’s the culprit.

removed panel_iframe and problem almost gone. have 1 or 2 times now in couple of days.

If you still experience those issues, please provide some additional data on the issue page