-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reoccuring aiohttp.server error - During handling of the above exception, another exception occurred #105158
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
@zocop your trace is completely different, please continue in a new issue |
Whats happening here is the client requests the websocket be closed and there is still data in the buffer which can't be written because the client has already closed the connection. if msg.type == WSMsgType.CLOSE:
self._closing = True
self._close_code = msg.data
if not self._closed and self._autoclose:
await self.close() |
@johntdyer Can you try this patch? diff --git a/aiohttp/web_ws.py b/aiohttp/web_ws.py
index 4e57bca4..3ff46d9f 100644
--- a/aiohttp/web_ws.py
+++ b/aiohttp/web_ws.py
@@ -56,7 +56,6 @@ class WebSocketReady:
class WebSocketResponse(StreamResponse):
-
_length_check = False
def __init__(
@@ -360,7 +359,9 @@ class WebSocketResponse(StreamResponse):
await self.close()
self._eof_sent = True
- async def close(self, *, code: int = WSCloseCode.OK, message: bytes = b"") -> bool:
+ async def close(
+ self, *, code: int = WSCloseCode.OK, message: bytes = b"", drain: bool = True
+ ) -> bool:
if self._writer is None:
raise RuntimeError("Call .prepare() first")
@@ -380,6 +381,7 @@ class WebSocketResponse(StreamResponse):
await self._writer.close(code, message)
writer = self._payload_writer
assert writer is not None
+ if drain:
await writer.drain()
except (asyncio.CancelledError, asyncio.TimeoutError):
self._close_code = WSCloseCode.ABNORMAL_CLOSURE
@@ -465,7 +467,11 @@ class WebSocketResponse(StreamResponse):
self._closing = True
self._close_code = msg.data
if not self._closed and self._autoclose:
- await self.close()
+ # The client is going to close the connection
+ # out from under us so we do not want to drain
+ # any pending writes as it will likely result
+ # writing to a broken pipe.
+ await self.close(drain=False)
elif msg.type == WSMsgType.CLOSING:
self._closing = True
elif msg.type == WSMsgType.PING and self._autoping: |
@bdraco how do I patch a hassos installation? Thought the container would revert when I restarted it to pick up the change? |
I'm also getting this error:
|
@bdraco I am happy to try and test your suggested patch, but I unfortunately am unsure how to do so in a HassOS installed system since the restart reverts the container to the default... Any guidance you can offer would certainly be appreciated |
@bdraco - Still seeing this ... would love to help test your fix but I am still unsure how best to do it on a hassos install... |
Linked some other other possible issues here: #106533 |
Still getting these constantly
|
@bdraco - How can I test your patch w/ a hassos install ? |
In the container do this git clone https://github.com/aio-libs/aiohttp
git checkout -t origin/3.9
apk add e2fsprogs npm clang autoconf automake libtool m4 gmp-dev mpfr-dev mpc1-dev gcc musl-dev openssl-dev libffi-dev ffmpeg-dev rust cargo zlib-dev jpeg-dev g++ make
fallocate -l 1G /usr/tmp-disk
mkfs.ext4 /usr/tmp-disk
mount -o loop -t ext4 /usr/tmp-disk /tmp
cd aiohttp
git submodule update --init
cd vendor/llhttp
npm update
make
cd ../..
make
pip3 install --upgrade -vvv .
pip3 install --upgrade typing_extensions
|
@bdraco restart the container after doing this ? |
|
@bdraco - 2 hours and counting an no reoccurance.... I do have a QQ... how was the provided commands able to get around the immutability of the container ? |
@bdraco - Wanted to follow up on my question about, re: a request for a brief explanation or reference I could dig into on how your steps got around the immutability of an app running in docker.. Secondly I wanted to mention that this seems to have definitely solved my problem, since I have not seen it since applying these steps |
See this error rather often, is there any movement regarding this? |
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. |
up |
Seeing this with
|
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. |
Up. See it sometimes occasionally. |
The problem
I keep getting these in my logs since 2023.12.0b* but considering it was beta I figured it was just me and held off reporting anything.. Today I installed 2023.12.0 and I am still getting these errors...
unfortunately I have not yet figured out how to readily reproduce the error, it just seems to happen every few mins
What version of Home Assistant Core has the issue?
core-2023.12.0
What was the last working version of Home Assistant Core?
core-2023-11
What type of installation are you running?
Home Assistant OS
Integration causing the issue
core
Link to integration documentation on our website
No response
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
The text was updated successfully, but these errors were encountered: