-
Notifications
You must be signed in to change notification settings - Fork 418
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
python: Fix GC isn't working correctly. #1888
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! But I'm afraid it won't work well because get_new_sym_addr()
always returns a new address even for the same name.
I think you need to compare func_name
instead. It'd have little more overhead but probably better to make GC working properly.
python/trace-python.c
Outdated
/* just compare pointers of the code object */ | ||
if (iter->code == code) { | ||
Py_DECREF(code); | ||
if (iter->addr == new_addr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should free func_name
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
1e0f0ba
to
efbe17c
Compare
Fixed thanks for the review, And use func_name is indeed a better way. and uftrace_py_traverse and uftrace_py_clean is no need either. |
python/trace-python.c
Outdated
if (iter->code == code) { | ||
Py_DECREF(code); | ||
/* compare func_name */ | ||
if (iter->name == func_name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can do this. It should call strcmp()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
efbe17c
to
4846f76
Compare
The uftrace_python_symbol keeps code PyObject in rb tree so GC can not run correctly in the trace process. Fixed the problem by dropping it. and change rb compare from code PyObject to func_name Fixed: namhyung#1886 Signed-off-by: Yi Hong <zouzou0208@gmail.com> Signed-off-by: Honggyu Kim <honggyu.kp@gmail.com>
4846f76
to
25e93b9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Hi @yihong0618, thanks very much for the fix. I've also found that it fixes the problem I reported. But you don't have to put my |
learned. will remember that next thanks a lot^_^ |
The uftrace_python_symbol keeps code PyObject in rb tree so GC can not run correctly in the trace process. Fixed the problem by dropping it.
Fixed: #1886