-
Notifications
You must be signed in to change notification settings - Fork 368
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
Segfault with Sqlalchemy #166
Comments
Well, a segfault is obviously bad, and we should try to make this fail more gracefully, but there's no reasonable way for us to make this work. Memray is trying to keep track of Python stack that led up to each allocation performed by the application. Greenlet is playing tricks to switch the stack that's running on a given thread without telling us. As the greenlet docs say:
Greenlet breaks the tools that we're using to keep track of the Python stack. The crash is caused by it breaking a pretty fundamental assumption that we made: if our profile function (set by In the greenlet world, this assumption doesn't hold: our profile function can be told that In theory, we could use
So, we'll take a look at whether we can do something to fail more gracefully, but at this point we don't intend to try to make this actually work. |
We've come up with reasonable solutions to several of these problems. For (2), we're willing to consider adding special support just for Greenlet, given that Greenlet is a fairly heavily used library, as long as the (maintenance and runtime) costs can be kept low enough. But that leads us to a new problem - I've entered python-greenlet/greenlet#310 to ask whether the Greenlet maintainers can do something to help us out with that. |
Bug Report
Memray triggers segfault running Sqlalchemy code using greenlets.
Input Code
It seems that the pointer argument to
PyCode_Addr2Line
is invalid. Testing withPYTHONDEVMODE=1
, it becomes 0xdddddddddddddddd, which corresponds to newly freed memory.Expected behavior/code
No crash.
Environment
The text was updated successfully, but these errors were encountered: