-
Notifications
You must be signed in to change notification settings - Fork 56
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
Memory faults on subscribers #668
Comments
Yes, the problem is reproduced on my machine as well.
In my environment, I called the (foo) function 10 times while restarting roseus, all of which printed 900 and caused a segmentation fault.
|
It is a workaround, I think.
|
@YoheiKakiuchi I have previously attempted a similar approach in #636 and was kind of uncertain if it made any sense, but I guess that it actually is a valid solution for this error then! |
Here is the correct place to fix this problem.
'args' is created on source of C-lang, so 'args' is not protected anywhere. |
This fix also seems stable! I see, so it is not exactly the object instance being collected but the list as a whole, right? Also any insights if we should dump the lisp symbol on unsubscriptions? |
Yes, list(cons) object is collected. objects in list are safe. Can we delete symbol ? I think reuse of symbol is realistic. |
I have been struggling with weird segfaults on my custom build for some time but I believe I have finally found a way to reproduce them in the release build:
rostopic pub /msg std_msgs/String "hello" -r 100
This will execute normally at first but eventually cause a segmentation fault if ran for long enough.
Testing with the 1.7.4-1bionic.20210505.033302 and 1.7.4-1bionic.20200930.061900 builds several times the segmentation fault occurred around 900, 2400 and 8600 iterations, depending on each run.
What I think the problem is
The subscribers registered in this case look something like
(#<compiled-code #X5610a667fe40 send> #<my-sub #X5610a6cdb6c8> :update)
and are attributed to symbols in the lisp package to avoid being garbage collected.However, I believe that the object instances within the registered and supposedly guarded list are actually succeptible to being garbage collected, leading to the observed segmentation faults.
I have also verified that the errors always occur just after a garbage collection.
@708yamaguchi Could you see if you can recreate the situation in your machine?
The text was updated successfully, but these errors were encountered: