Skip to content

Fix documented default for WebSocketResponse writer_limit - #13294

Merged
Dreamsorcerer merged 4 commits into
aio-libs:masterfrom
LALITH0110:docs/websocketresponse-writer-limit-default
Aug 23, 2026
Merged

Dreamsorcerer merged 4 commits into
aio-libs:masterfrom
LALITH0110:docs/websocketresponse-writer-limit-default

Conversation

@LALITH0110

Copy link
Copy Markdown
Contributor

What do these changes do?

Correct the documented default for WebSocketResponse's writer_limit parameter in docs/web_reference.rst.

The reference documented it in two places:

  • the class signature, as writer_limit=65536
  • the parameter description, as "maximum size of write buffer, 64 KB by default"

The actual default in aiohttp/web_ws.py is writer_limit: int = DEFAULT_CHUNK_SIZE, and DEFAULT_CHUNK_SIZE is 2**18 in aiohttp/helpers.py — that is 262144 bytes, or 256 KiB. So the documented value understated the real default by a factor of four.

The signature now reads writer_limit=262144, matching how the neighbouring max_msg_size=4194304 is written, and the prose now says "256 KiB by default".

Documentation only — no code changes.

Are there changes in behavior for the user?

No. Nothing in the library changes. Users reading the docs to size a WebSocket write buffer will now see the value the code actually uses.

Is it a substantial burden for the maintainers to support this?

No. It is a two-line documentation correction with no ongoing maintenance cost.

Related issue number

None — found while comparing documented parameter defaults against the actual signatures.

Checklist

  • I think the code is well written
  • Unit tests for the changes exist — N/A, documentation-only change
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
  • Add a new news fragment into the CHANGES/ folder

Drafted with Claude Opus 5; reviewed by @LALITH0110.

The reference documented `writer_limit` as `65536` in the class signature
and as "64 KB by default" in the parameter description, but the actual
default is `DEFAULT_CHUNK_SIZE`, which is `2**18` (262144 bytes, 256 KiB).

Readers sizing a WebSocket write buffer from the docs were working from a
value four times smaller than the real one.
@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided There is a change note present in this PR label Jul 31, 2026
@codecov

codecov Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.02%. Comparing base (5836019) to head (c8a3bb6).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #13294   +/-   ##
=======================================
  Coverage   99.02%   99.02%           
=======================================
  Files         135      135           
  Lines       49992    49992           
  Branches     2597     2597           
=======================================
  Hits        49507    49507           
  Misses        366      366           
  Partials      119      119           
Flag Coverage Δ
Autobahn 22.02% <ø> (ø)
CI-GHA 98.93% <ø> (+<0.01%) ⬆️
OS-Linux 98.70% <ø> (+<0.01%) ⬆️
OS-Windows 97.04% <ø> (+<0.01%) ⬆️
OS-macOS 97.95% <ø> (ø)
Py-3.10 98.15% <ø> (ø)
Py-3.11 98.39% <ø> (+<0.01%) ⬆️
Py-3.12 98.47% <ø> (ø)
Py-3.13 98.47% <ø> (+<0.01%) ⬆️
Py-3.14 98.48% <ø> (-0.01%) ⬇️
Py-3.14t 97.57% <ø> (ø)
Py-pypy-3.11 97.43% <ø> (-0.01%) ⬇️
VM-macos 97.95% <ø> (ø)
VM-ubuntu 98.70% <ø> (+<0.01%) ⬆️
VM-windows 97.04% <ø> (+<0.01%) ⬆️
cython-coverage 83.01% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@codspeed

codspeed Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 2.44%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
❌ 2 (👁 2) regressed benchmarks
✅ 89 untouched benchmarks
⏩ 83 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ test_read_base64_part 16 ms 14.1 ms +13.06%
👁 test_list_element_pattern_redos_payload[interleaved_quote_paren_triggers] 87.5 ms 96.4 ms -9.25%
👁 test_list_element_pattern_redos_payload[whitespace_run_after_content] 30.9 ms 34.2 ms -9.49%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing LALITH0110:docs/websocketresponse-writer-limit-default (c8a3bb6) with master (5836019)

Open in CodSpeed

Footnotes

  1. 83 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@LALITH0110
LALITH0110 marked this pull request as ready for review July 31, 2026 05:12
@Dreamsorcerer Dreamsorcerer added backport-3.14 Trigger automatic backporting to the 3.14 release branch by Patchback robot backport-3.15 Trigger automatic backporting to the 3.15 release branch by Patchback robot labels Aug 23, 2026
@greptile-apps

greptile-apps Bot commented Aug 23, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (2): Last reviewed commit: "Update web_reference.rst" | Re-trigger Greptile

Comment thread docs/web_reference.rst
Comment thread docs/web_reference.rst Outdated
@Dreamsorcerer
Dreamsorcerer merged commit f1c70aa into aio-libs:master Aug 23, 2026
52 checks passed
@patchback

patchback Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Backport to 3.15: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply f1c70aa on top of patchback/backports/3.15/f1c70aa4b9160798603f56fd84937d78741ada53/pr-13294

Backporting merged PR #13294 into master

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/aio-libs/aiohttp.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/3.15/f1c70aa4b9160798603f56fd84937d78741ada53/pr-13294 upstream/3.15
  4. Now, cherry-pick PR Fix documented default for WebSocketResponse writer_limit #13294 contents into that branch:
    $ git cherry-pick -x f1c70aa4b9160798603f56fd84937d78741ada53
    If it'll yell at you with something like fatal: Commit f1c70aa4b9160798603f56fd84937d78741ada53 is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x f1c70aa4b9160798603f56fd84937d78741ada53
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR Fix documented default for WebSocketResponse writer_limit #13294 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/3.15/f1c70aa4b9160798603f56fd84937d78741ada53/pr-13294
  7. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@patchback

patchback Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Backport to 3.14: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply f1c70aa on top of patchback/backports/3.14/f1c70aa4b9160798603f56fd84937d78741ada53/pr-13294

Backporting merged PR #13294 into master

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/aio-libs/aiohttp.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/3.14/f1c70aa4b9160798603f56fd84937d78741ada53/pr-13294 upstream/3.14
  4. Now, cherry-pick PR Fix documented default for WebSocketResponse writer_limit #13294 contents into that branch:
    $ git cherry-pick -x f1c70aa4b9160798603f56fd84937d78741ada53
    If it'll yell at you with something like fatal: Commit f1c70aa4b9160798603f56fd84937d78741ada53 is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x f1c70aa4b9160798603f56fd84937d78741ada53
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR Fix documented default for WebSocketResponse writer_limit #13294 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/3.14/f1c70aa4b9160798603f56fd84937d78741ada53/pr-13294
  7. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@Dreamsorcerer

Copy link
Copy Markdown
Member

Please follow instructions above for backports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-3.14 Trigger automatic backporting to the 3.14 release branch by Patchback robot backport-3.15 Trigger automatic backporting to the 3.15 release branch by Patchback robot bot:chronographer:provided There is a change note present in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants