Skip to content
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

Restore zero copy writes on Python 3.12.9+/3.13.2+ #10137

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Dec 6, 2024

TODO

  • Hold until 3.13.2 release day: Tuesday, 2025-02-04
  • Wait for GitHub to update 3.13 runners to 3.13.2
  • Re-run benchmarks
  • If benchmarks show the perf regression is fixed, this should be good to move forward and do a new release

What do these changes do?

Restore zero copy support on Python 3.12.9+/3.13.2+ (unreleased at this time)
CVE-2024-12254 aka GHSA-fw89-6wjj-8j95 is fixed on these Python versions

Are there changes in behavior for the user?

The performance regression introduced by disabling zero copy writes in #10125 will be resolved

The relevant benchmarks (keep in mind we are benchmarking disabling zero copy writes), and this PR seeks to restore the performance:

test_one_hundred_get_requests_with_1024_chunked_payload +3% (writelines is a bit worse for tiny payloads)
test_one_hundred_get_requests_with_512kib_chunked_payload -21% (writelines is a lot better for large payloads)
test_one_hundred_get_requests_with_30000_chunked_payload -4% (writelines is a slightly better for medium size payloads)

Since we already have to branch here, I also added MIN_PAYLOAD_FOR_WRITELINES to 2048 to ensure we no longer take the 3% performance hit for writelines with small payloads

@bdraco bdraco changed the title Restore zero copy support on Python 3.12.9+/3.13.2+ Restore zero copy writes on Python 3.12.9+/3.13.2+ Dec 6, 2024
@bdraco bdraco added backport-3.11 Trigger automatic backporting to the 3.11 release branch by Patchback robot backport-3.12 Trigger automatic backporting to the 3.12 release branch by Patchback robot labels Dec 6, 2024
Copy link

codspeed-hq bot commented Dec 6, 2024

CodSpeed Performance Report

Merging #10137 will not alter performance

Comparing restore_zero_copy (85b21f7) with master (dbd77ad)

Summary

✅ 47 untouched benchmarks

Copy link

codecov bot commented Dec 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.75%. Comparing base (dbd77ad) to head (85b21f7).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10137      +/-   ##
==========================================
+ Coverage   97.18%   98.75%   +1.56%     
==========================================
  Files         120      122       +2     
  Lines       36888    37031     +143     
  Branches     4301     4432     +131     
==========================================
+ Hits        35851    36571     +720     
+ Misses        824      313     -511     
+ Partials      213      147      -66     
Flag Coverage Δ
CI-GHA 98.64% <100.00%> (+1.45%) ⬆️
OS-Linux 98.33% <100.00%> (?)
OS-Windows 96.18% <100.00%> (?)
OS-macOS 97.44% <100.00%> (+0.25%) ⬆️
Py-3.10.11 97.28% <100.00%> (?)
Py-3.10.15 97.82% <100.00%> (?)
Py-3.11.10 97.86% <100.00%> (?)
Py-3.11.9 97.32% <100.00%> (?)
Py-3.12.7 98.39% <100.00%> (?)
Py-3.13.0 97.19% <100.00%> (+0.01%) ⬆️
Py-3.13.1 98.34% <100.00%> (?)
Py-3.9.13 97.20% <100.00%> (?)
Py-3.9.20 97.78% <100.00%> (?)
Py-pypy7.3.16 97.35% <100.00%> (?)
VM-macos 97.44% <100.00%> (+0.25%) ⬆️
VM-ubuntu 98.33% <100.00%> (?)
VM-windows 96.18% <100.00%> (?)

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

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

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Dec 6, 2024
aiohttp/http_writer.py Outdated Show resolved Hide resolved
CHANGES/10137.misc.rst Outdated Show resolved Hide resolved
aiohttp/http_writer.py Outdated Show resolved Hide resolved
@webknjaz

This comment was marked as resolved.

@webknjaz

This comment was marked as resolved.

bdraco and others added 5 commits December 6, 2024 11:23
CVE-2024-12254 aka GHSA-fw89-6wjj-8j95 is fixed on these
Python versions
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
@bdraco bdraco force-pushed the restore_zero_copy branch from 894af34 to 85b21f7 Compare December 6, 2024 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-3.11 Trigger automatic backporting to the 3.11 release branch by Patchback robot backport-3.12 Trigger automatic backporting to the 3.12 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.

3 participants