FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GH-65046: Fix docs about logging in `asyncio` by kumaraditya303 · Pull Request #97559 · python/cpython · GitHub

/ cpython Public

GH-65046: Fix docs about logging in asyncio - #97559

Merged
gvanrossum merged 4 commits into
python:mainfrom
kumaraditya303:asyncio-docs
Sep 26, 2022
Merged

GH-65046: Fix docs about logging in asyncio#97559
gvanrossum merged 4 commits into
python:mainfrom
kumaraditya303:asyncio-docs

Conversation

kumaraditya303 commented Sep 26, 2022
edited
Loading

Copy link
Copy Markdown
Contributor

Comment thread Doc/library/asyncio-dev.rst Outdated


Network logging can block the event loop, it is recommended to use
a separate thread for handling logs or use non blocking io.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think it should be spelled non-blocking I/O, but the bigger issue is that it’s not immediately clear what one should use: after all, we are in the async I/O docs! Is there a section in the os module or another part of the stdlib that explains how to do non-asyncio non-blocking I/O?

Comment thread Doc/library/asyncio-dev.rst Outdated

gvanrossum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

One nit, I don't think a comma is quite right here. I'll apply my suggestion and merge your PR.

Comment thread Doc/library/asyncio-dev.rst Outdated
gvanrossum merged commit d68c37c into python:main Sep 26, 2022

Copy link
Copy Markdown
Contributor

Thanks @kumaraditya303 for the PR, and @gvanrossum for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

Copy link
Copy Markdown
Contributor

Sorry @kumaraditya303 and @gvanrossum, I had trouble checking out the 3.11 backport branch.
Please backport using cherry_picker on command line.
cherry_picker d68c37c0d08542a346a13b150a204208bb0408f5 3.11

bedevere-bot removed the needs backport to 3.10 only security fixes label Sep 26, 2022

Copy link
Copy Markdown

GH-97581 is a backport of this pull request to the 3.10 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 26, 2022
Explain that logging should not use network I/O.
(cherry picked from commit d68c37c)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>

merwok commented Sep 26, 2022

Copy link
Copy Markdown
Member

No reaction to my remark about the vagueness of the new recommendation?

Copy link
Copy Markdown
Member

No reaction to my remark about the vagueness of the new recommendation?

I apologize, I was in "get things merged" mode and missed that.

That said, I doubt we have something more specific than "use threads or write to disk" -- and while writing to disk is technically not perfect, it's generally considered good enough for asyncio (we've been told that there are async APIs for writing to disk on some platforms, and IIRC there are 3rd party packages that wrap them, but the benefits are at best marginal, and the code isn't portable.

Also, I think the warning is about configuring a logger that uses network I/O rather than about how user code should do their own logging. The point is that asyncio itself sometimes calls the logging module and the user should avoid messing that up by accidentally configuring a network-using logger.

User code can just use the run_in_executor API to do the logging from a thread, but we don't want to do that for asyncio's own logging.

gvanrossum removed the needs backport to 3.11 only security fixes label Sep 26, 2022
gvanrossum added the needs backport to 3.11 only security fixes label Sep 26, 2022

Copy link
Copy Markdown
Contributor

Thanks @kumaraditya303 for the PR, and @gvanrossum for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

Copy link
Copy Markdown

GH-97582 is a backport of this pull request to the 3.11 branch.

bedevere-bot removed the needs backport to 3.11 only security fixes label Sep 26, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 26, 2022
Explain that logging should not use network I/O.
(cherry picked from commit d68c37c)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
miss-islington added a commit that referenced this pull request Sep 26, 2022
Explain that logging should not use network I/O.
(cherry picked from commit d68c37c)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
miss-islington added a commit that referenced this pull request Sep 26, 2022
Explain that logging should not use network I/O.
(cherry picked from commit d68c37c)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
kumaraditya303 deleted the asyncio-docs branch September 27, 2022 10:50
pablogsal pushed a commit that referenced this pull request Oct 22, 2022
Explain that logging should not use network I/O.
(cherry picked from commit d68c37c)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news topic-asyncio

Projects

None yet

Development

Successfully merging this pull request may close these issues.

asyncio docs should call out that network logging is a no-no

5 participants


Back | FazBrowse Home | New Git URL