vmprof-python icon indicating copy to clipboard operation
vmprof-python copied to clipboard

Python 3.5 async/await seems to yield wrong stack traces

Open planrich opened this issue 8 years ago • 5 comments

vmprof just walks the stack traces. this can be problematic for when async/await is used. need to flesh out some details how it works and what vmprof should do different in such cases.

planrich avatar Feb 17 '17 09:02 planrich

Here is a sample from @njsmith https://gist.github.com/njsmith/1c3742362bb6f5cc505f69cb66db2e71

planrich avatar Feb 17 '17 10:02 planrich

NB I just updated the example gist to give a bit more details.

njsmith avatar Feb 17 '17 10:02 njsmith

In a truly baffling turn of events, I can no longer reproduce the weird results in that gist -- rerunning the exact same command line now gives me more sensible results.

njsmith avatar Feb 17 '17 12:02 njsmith

Okay, figured it out... the issue is that if you re-enter a coroutine/generator stack via send, then everything works as you'd expect. But if you re-enter using throw, then you get the weird thing I saw before. (This is on CPython only -- PyPy gives sensible results in both cases.)

Self-container reproducer: https://gist.github.com/njsmith/d566941ee3566f2c69f45c5bab65eb51

njsmith avatar Feb 17 '17 14:02 njsmith

filed upstream: https://bugs.python.org/issue29590

njsmith avatar Feb 17 '17 14:02 njsmith