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

Retry connection #7363

Merged
merged 13 commits into from
Jan 20, 2024
Merged

Retry connection #7363

merged 13 commits into from
Jan 20, 2024

Conversation

Dreamsorcerer
Copy link
Member

@Dreamsorcerer Dreamsorcerer commented Jul 11, 2023

Fixes #7297.

@Dreamsorcerer Dreamsorcerer marked this pull request as ready for review July 15, 2023 20:14
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Jul 15, 2023
@codecov
Copy link

codecov bot commented Jul 15, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (fde452d) 97.30% compared to head (bd04e03) 97.48%.
Report is 468 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7363      +/-   ##
==========================================
+ Coverage   97.30%   97.48%   +0.18%     
==========================================
  Files         106      107       +1     
  Lines       31456    32601    +1145     
  Branches     3940     3799     -141     
==========================================
+ Hits        30608    31782    +1174     
+ Misses        644      616      -28     
+ Partials      204      203       -1     
Flag Coverage Δ
CI-GHA 97.40% <100.00%> (+0.19%) ⬆️
OS-Linux 97.07% <100.00%> (+0.19%) ⬆️
OS-Windows 95.57% <100.00%> (+0.23%) ⬆️
OS-macOS 96.89% <100.00%> (+0.42%) ⬆️
Py-3.10.11 95.50% <100.00%> (-1.49%) ⬇️
Py-3.10.13 96.87% <100.00%> (?)
Py-3.11.0 ?
Py-3.11.7 96.56% <100.00%> (?)
Py-3.12.1 96.69% <100.00%> (?)
Py-3.7.16 ?
Py-3.7.9 ?
Py-3.8.10 95.47% <100.00%> (+0.33%) ⬆️
Py-3.8.16 ?
Py-3.8.18 96.81% <100.00%> (?)
Py-3.9.13 95.47% <100.00%> (+0.34%) ⬆️
Py-3.9.16 ?
Py-3.9.18 96.85% <100.00%> (?)
Py-pypy7.3.11 ?
Py-pypy7.3.15 96.40% <100.00%> (?)
VM-macos 96.89% <100.00%> (+0.42%) ⬆️
VM-ubuntu 97.07% <100.00%> (+0.19%) ⬆️
VM-windows 95.57% <100.00%> (+0.23%) ⬆️

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.

aiohttp/client.py Outdated Show resolved Hide resolved
@Dreamsorcerer Dreamsorcerer added backport-3.10 Trigger automatic backporting to the 3.10 release branch by Patchback robot and removed backport-3.9 labels Jan 4, 2024
aiohttp/client.py Outdated Show resolved Hide resolved
@bdraco
Copy link
Member

bdraco commented Jan 9, 2024

I think this is a good solution. This problem comes up all the time with new libraries in Home Assistant.

The downside is that there will already be downstream retry code so it may get retried once more downstream again. I don't think thats a blocker, but its probably important to highlight that downstream retry code should be removed

@Dreamsorcerer
Copy link
Member Author

The downside is that there will already be downstream retry code so it may get retried once more downstream again. I don't think thats a blocker, but its probably important to highlight that downstream retry code should be removed

Sure, though we only retry once. I think custom retry logic often has multiple retries, so some may want to keep it anyway.

@bdraco
Copy link
Member

bdraco commented Jan 10, 2024

The downside is that there will already be downstream retry code so it may get retried once more downstream again. I don't think thats a blocker, but its probably important to highlight that downstream retry code should be removed

Sure, though we only retry once. I think custom retry logic often has multiple retries, so some may want to keep it anyway.

It looks like all the ones HA has done only retry once as well. So now they will retry twice. I think this is acceptable risk.

Copy link
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, only outstanding comment from me is the set constant

aiohttp/client.py Outdated Show resolved Hide resolved
@Dreamsorcerer Dreamsorcerer merged commit be9a3cc into master Jan 20, 2024
32 of 34 checks passed
@Dreamsorcerer Dreamsorcerer deleted the retry-connection branch January 20, 2024 14:11
Copy link
Contributor

patchback bot commented Jan 20, 2024

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

❌ Failed to cleanly apply be9a3cc on top of patchback/backports/3.10/be9a3cc9b3e617cb146093df6e05a73258aedb39/pr-7363

Backporting merged PR #7363 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.10/be9a3cc9b3e617cb146093df6e05a73258aedb39/pr-7363 upstream/3.10
  4. Now, cherry-pick PR Retry connection #7363 contents into that branch:
    $ git cherry-pick -x be9a3cc9b3e617cb146093df6e05a73258aedb39
    If it'll yell at you with something like fatal: Commit be9a3cc9b3e617cb146093df6e05a73258aedb39 is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x be9a3cc9b3e617cb146093df6e05a73258aedb39
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR Retry connection #7363 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/3.10/be9a3cc9b3e617cb146093df6e05a73258aedb39/pr-7363
  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 added a commit that referenced this pull request Jan 20, 2024
Fixes #7297

(cherry picked from commit be9a3cc)
Dreamsorcerer added a commit that referenced this pull request Jan 20, 2024
Fixes #7297

(cherry picked from commit be9a3cc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-3.10 Trigger automatic backporting to the 3.10 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.

Client attempts to reuse a closed connection if "Connection: keep-alive" header was received
3 participants