Skip to content

Commit 7894232

Browse files
committed
Fix: aiohttp assert exception on connection lost (#406)
Problem: a bug in aiohttp causes an assertion error to appear in the logs whenever an HTTP connection is lost. Solution: there is no mainline fix in aiohttp. It is not trivial to install a forked version of aiohttp, so the simplest solution for now is to apply the aiohttp patch directly. Bumped aiohttp to 3.8.4 at the same time.
1 parent 9ee2a64 commit 7894232

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

deployment/docker-build/aiohttp.diff

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/aiohttp/web_protocol.py b/aiohttp/web_protocol.py
2+
index 10a96080..f103b167 100644
3+
--- a/aiohttp/web_protocol.py
4+
+++ b/aiohttp/web_protocol.py
5+
@@ -299,6 +299,8 @@ class RequestHandler(BaseProtocol):
6+
exc = ConnectionResetError("Connection lost")
7+
self._current_request._cancel(exc)
8+
9+
+ if self._task_handler is not None:
10+
+ self._task_handler.cancel()
11+
if self._waiter is not None:
12+
self._waiter.cancel()
13+

deployment/docker-build/pyaleph.dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ COPY deployment/scripts ./deployment/scripts
5151
COPY .git ./.git
5252
COPY src ./src
5353
RUN pip install -e .
54+
COPY deployment/docker-build/aiohttp.diff /tmp/aiohttp.diff
55+
RUN patch /opt/venv/lib/python3.11/site-packages/aiohttp/web_protocol.py /tmp/aiohttp.diff
5456

5557

5658
FROM base

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ install_requires =
3636
aiocache==0.11.1
3737
aiohttp-cors==0.7.0
3838
aiohttp-jinja2==1.5
39-
aiohttp==3.8.3
39+
aiohttp==3.8.4
4040
aioipfs@git+https://github.com/aleph-im/aioipfs.git@d671c79b2871bb4d6c8877ba1e7f3ffbe7d20b71
4141
alembic==1.8.1
4242
aleph-message==0.3.2

0 commit comments

Comments
 (0)