Comments (5)
I think that this might be an artifact of how I'm collecting the stack trace: I'm not pausing the python program, and the stack trace is gotten by traversing a linked list of frame objects from the target python processes memory. If the python program returns from a function call while this is happening, it could mess up this traversal and lead to results like you saw.
I've been thinking about adding an option to pause the python process while the stack is collected - which should prevent this (with the downside of potentially slowing the process down slightly).
from py-spy.
I think I've managed to replicate this - it seems to mainly happen with deep-ish callstacks, where the python functions aren't taking any significant time.
It'd be great to figure out a way to discard these callstacks so we can keep the profiler from blocking the python program - but I can't see any way of doing it right now (just with a higher error rate during sampling). The problem is that the end of the a legitimate call stack is indicated by a null pointer on the 'next' frame - which is the same thing that is happening here. Going to see if pausing the python program with ptrace etc resolves this
from py-spy.
This commit seems to fix: e25656c
from py-spy.
fixed in v0.1.9
from py-spy.
Sweet, thanks. Updated and my use-case seems to be working fine now.
Also, the slow-down is just 3% in the case I tried.
Tested on macos 10.13
from py-spy.
Related Issues (20)
- Elf sbss issue HOT 1
- Option to get native thread ID with best effort HOT 2
- Encounter os error 31 with py-spy record
- Python 3.12 support HOT 10
- Python 3.11 --native profiling fails because of bpo-45256 HOT 1
- Seg fault on py-spy record --subprocesses
- Test `--native` option in CI
- redirect to stdoutput
- py_spy fails to find interpreter on Windows HOT 4
- Assertion errors when HOT 2
- `--native` HOT 2
- Consider moving CLI functionality behind a feature flag
- attempt to subtract with overflow in console_viewer.rs
- libproc v0.13.0 doesn't build for me
- Programmatically start/stop py-spy recording HOT 1
- Panics at times when sampling a Django app HOT 1
- No source distribution files available in the Pypi site
- Flame graphs cpu on-off
- Add build instruction to README
- Use as python library HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from py-spy.