Skip to content

Fix keepalive connections not being closed in time#4956

Merged
asvetlov merged 4 commits intoaio-libs:masterfrom
bitphage:fix/keepalive_connections_closing
Oct 17, 2020
Merged

Fix keepalive connections not being closed in time#4956
asvetlov merged 4 commits intoaio-libs:masterfrom
bitphage:fix/keepalive_connections_closing

Conversation

@bitphage
Copy link
Copy Markdown
Contributor

@bitphage bitphage commented Sep 10, 2020

What do these changes do?

Refactoring in 964921d introduced a regression so that _cleanup() could be called only once or few times. _release() expects self._cleanup_handle to be None to add new weakref_handle. But when _cleanup() called and there are no remaining connections, self._cleanup_handle will remain as <TimerHandle cancelled when=5853434>, so _release() will not have a chance to schedule _cleanup() call again.

Closes: #3296

Are there changes in behavior for the user?

Related issue number

#3296

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
    • The format is <Name> <Surname>.
    • Please keep alphabetical order, the file is sorted by names.
  • Add a new news fragment into the CHANGES folder
    • name it <issue_id>.<type> for example (588.bugfix)
    • if you don't have an issue_id change it to the pr id after creating the pr
    • ensure type is one of the following:
      • .feature: Signifying a new feature.
      • .bugfix: Signifying a bug fix.
      • .doc: Signifying a documentation improvement.
      • .removal: Signifying a deprecation or removal of public API.
      • .misc: A ticket has been closed, but it is not of interest to users.
    • Make sure to use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files."

Refactoring in 964921d introduced a
regression so that `_cleanup()` could be called only once or few times.
`_release()` expects `self._cleanup_handle` to be None to add new
`weakref_handle`. But when `_cleanup()` called and there are no
remaining connections, `self._cleanup_handle` will remain as
`<TimerHandle cancelled when=5853434>`, so `_release()` will not have a
chance to schedule `_cleanup()` call again.

Closes: aio-libs#3296
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Sep 10, 2020
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Sep 10, 2020

Codecov Report

Merging #4956 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4956   +/-   ##
=======================================
  Coverage   97.60%   97.60%           
=======================================
  Files          43       43           
  Lines        8932     8933    +1     
  Branches     1406     1406           
=======================================
+ Hits         8718     8719    +1     
  Misses         95       95           
  Partials      119      119           
Impacted Files Coverage Δ
aiohttp/connector.py 96.29% <100.00%> (+<0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5f0a59f...8188e49. Read the comment docs.

@asvetlov asvetlov merged commit 35b3174 into aio-libs:master Oct 17, 2020
github-actions bot pushed a commit that referenced this pull request Oct 17, 2020
@github-actions
Copy link
Copy Markdown
Contributor

💚 Backport successful

The PR was backported to the following branches:

github-actions bot pushed a commit that referenced this pull request Oct 17, 2020
@github-actions
Copy link
Copy Markdown
Contributor

💚 Backport successful

The PR was backported to the following branches:

aio-libs-github-bot bot pushed a commit that referenced this pull request Oct 17, 2020
Backports the following commits to 3.7:
 - Fix keepalive connections not being closed in time (#4956)

Co-authored-by: Vladimir Kamarzin <[email protected]>
@bitphage bitphage deleted the fix/keepalive_connections_closing branch October 18, 2020 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

aiohttp client session. it doesn't close a connection after keepalive_timeout

3 participants