Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uvloop missing debug slow callback information. #103

Closed
InvaderGir1 opened this issue Aug 30, 2017 · 2 comments
Closed

Uvloop missing debug slow callback information. #103

InvaderGir1 opened this issue Aug 30, 2017 · 2 comments

Comments

@InvaderGir1
Copy link

InvaderGir1 commented Aug 30, 2017

  • 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.

@1st1
Copy link
Member

1st1 commented Nov 21, 2017

Fixed in master. Will be in the next release (soon)

@1st1 1st1 closed this as completed Nov 21, 2017
@1st1
Copy link
Member

1st1 commented Nov 27, 2017

Please try uvloop v0.9.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants