This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: asyncio: enable debug mode when -X dev is used
Type: Stage: resolved
Components: asyncio Versions: Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: vstinner, yselivanov
Priority: normal Keywords: patch

Created on 2017-11-16 11:50 by vstinner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
block_loop.py vstinner, 2017-11-16 11:50
Pull Requests
URL Status Linked Edit
PR 4418 merged vstinner, 2017-11-16 11:51
Messages (3)
msg306353 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-11-16 11:50
The bpo-32043 added a new "developer mode" enabled with the new -X dev command line option.

I propose to enable asyncio debug mode with the global Python "developer mode".

If an asyncio application is correctly written, the single side effect of -X dev would be to log "Executing ... took ... seconds" if a handle took longer than 100 ms. Well, a handle should *not* take longer than 100 ms. So maybe it's ok to start logging such events in the "developer mode", no?


Example with attached block_loop.py script which blocks the event loop.

(1) This command doesn't display anything:

haypo@selma$ ./python block_loop.py 


(2) In developer mode, the warning a emitted to warn the developer about the bug:

$ ./python -X dev block_loop.py 
Executing <Task finished coro=<block_loop() done, defined at block_loop.py:4> result=None created at /home/haypo/prog/python/master/Lib/asyncio/base_events.py:444> took 1.002 seconds
msg306360 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-11-16 14:01
I sent an email about this change to python-dev: https://mail.python.org/pipermail/python-dev/2017-November/150572.html
msg306552 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-11-20 15:14
New changeset 44862df2eeec62adea20672b0fe2a5d3e160569e by Victor Stinner in branch 'master':
bpo-32047: -X dev enables asyncio debug mode (#4418)
https://github.com/python/cpython/commit/44862df2eeec62adea20672b0fe2a5d3e160569e
History
Date User Action Args
2022-04-11 14:58:54adminsetgithub: 76228
2017-11-20 15:14:29vstinnersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-11-20 15:14:09vstinnersetmessages: + msg306552
2017-11-16 14:01:28vstinnersetmessages: + msg306360
2017-11-16 11:51:37vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request4367
2017-11-16 11:50:52vstinnercreate