Skip to content

Fix race condition on connect when tracing is active (#5259)#5285

Merged
asvetlov merged 1 commit intoaio-libs:masterfrom
bobh66:5259.bugfix
Nov 26, 2020
Merged

Fix race condition on connect when tracing is active (#5259)#5285
asvetlov merged 1 commit intoaio-libs:masterfrom
bobh66:5259.bugfix

Conversation

@bobh66
Copy link
Copy Markdown
Contributor

@bobh66 bobh66 commented Nov 24, 2020

Acquire the connection before running traces, to prevent race condition.

This change will ensure that the limit and limit_per_host functionality in BaseConnector works when traces are configured.

NOTE: Unit tests are TBD as this is an async race condition which is extremely difficult to unit test. Suggestions are welcome.

Related issue number

Fixes #5259

Checklist

  • [X ] 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."

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Nov 24, 2020
@codecov
Copy link
Copy Markdown

codecov bot commented Nov 24, 2020

Codecov Report

Merging #5285 (4b695ab) into master (6f73339) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5285      +/-   ##
==========================================
- Coverage   97.54%   97.53%   -0.02%     
==========================================
  Files          43       43              
  Lines        8794     8789       -5     
  Branches     1415     1410       -5     
==========================================
- Hits         8578     8572       -6     
- Misses        101      103       +2     
+ Partials      115      114       -1     
Flag Coverage Δ
unit 97.41% <100.00%> (+0.04%) ⬆️

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

Impacted Files Coverage Δ
aiohttp/connector.py 96.51% <100.00%> (-0.30%) ⬇️
aiohttp/client_exceptions.py 98.33% <0.00%> (-1.67%) ⬇️
aiohttp/cookiejar.py 98.78% <0.00%> (-0.39%) ⬇️
aiohttp/web_server.py 94.28% <0.00%> (-0.16%) ⬇️
aiohttp/pytest_plugin.py 97.45% <0.00%> (-0.05%) ⬇️
aiohttp/web_runner.py 97.76% <0.00%> (-0.01%) ⬇️
aiohttp/web.py 99.14% <0.00%> (-0.01%) ⬇️
aiohttp/abc.py 100.00% <0.00%> (ø)
aiohttp/resolver.py 93.18% <0.00%> (ø)
... and 5 more

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 6f73339...4b695ab. Read the comment docs.

@asvetlov asvetlov merged commit e4faf77 into aio-libs:master Nov 26, 2020
@asvetlov
Copy link
Copy Markdown
Member

Thanks!

@aio-libs-github-bot
Copy link
Copy Markdown
Contributor

💚 Backport successful

The PR was backported to the following branches:

asvetlov added a commit that referenced this pull request Nov 26, 2020
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.

BaseConnector limit and limit_per_host don't work with tracing enabled

2 participants