Skip to content

Commit

Permalink
Increase aiohttp read buffer to 2MiB (#138)
Browse files Browse the repository at this point in the history
The previous default (64KiB) would cause `ValueError: Line is too long`
exceptions on watch events with large objects.

Requires aiohttp >= 3.7.0
  • Loading branch information
JacobHenner authored Feb 14, 2021
1 parent b33cde2 commit 1bf1232
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion kubernetes_asyncio/client/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,14 @@ def __init__(self, configuration, pools_size=4, maxsize=None):

# https pool manager
self.pool_manager = aiohttp.ClientSession(
connector=connector
connector=connector,
# Watch events containing large resource objects can exceed
# aiohttp's default read buffer size.
#
# There is no hard-limit defined by k8s, but the etcd default
# maximum request size is 1.5MiB.
# https://github.com/kubernetes/kubernetes/issues/19781
read_bufsize=2**21
)

async def close(self):
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ python-dateutil>=2.5.3 # BSD
setuptools>=21.0.0 # PSF/ZPL
urllib3>=1.24.2 # MIT
pyyaml>=3.12 # MIT
aiohttp>=2.3.10,<4.0.0 # # Apache-2.0
aiohttp>=3.7.0,<4.0.0 # # Apache-2.0

0 comments on commit 1bf1232

Please sign in to comment.