Skip to content

Uvloop missing debug slow callback information. #103

Closed
@InvaderGir1

Description

@InvaderGir1
  • uvloop version: 0.8.0
  • Python version: 3.6.0
  • Platform: OS-X Sierra 10.12.6
  • Can you reproduce the bug with PYTHONASYNCIODEBUG in env?: Yes

Hi, I wrote a project using uvloop, and I wanted to start profiling to see what methods take long. From what I am aware of cProfile, etc.. don't support asyncio very well (maybe I am wrong?, is there something advised for profiling asyncio code?)

I noticed in the documentation of python that by doing set_debug and reducing slow_callback_duration I can see what methods are taking long. But when using uvloop, I don't get all the information. I saw it was discussed in python/asyncio#105 and fixed. (Probably in the basic loop, it was fixed.)

Code Example:

import uvloop
import asyncio
loop = uvloop.new_event_loop()
asyncio.set_event_loop(loop)
loop = asyncio.get_event_loop()
loop.set_debug(True)
loop.slow_callback_duration = 0.01
loop.run_until_complete(slow_func())
loop.close()

if I use uvloop as my event loop I get this message:
Executing <Handle <TaskSendMethWrapper object at 0x1060e7860> created at /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/tasks.py:512> took 0.205 seconds

If I comment out the uvloop and use the standard loop I get:
Executing <Task finished coro=<slow_func() done, defined at Launcher.py:13> result=None created at /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py:446> took 0.206 seconds

This helps pinpoint what function is doing the problem.
Thanks,
And sorry for the long description.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions