Open Nickiven opened 1 year ago
Can reproduce this issue on Ubuntu with Ros2 Humble and the talker example, removing the Sleep
call speeds the whole process up.
I think it is somehow caused by the garbage collector since removing all calls to Shutdown
does not fix this issue while calling GC.TryStartNoGCRegion
(or GC.GetGCMemoryInfo
, I dont know why) seem to prevent it.
Furthermore, the issue does not occur using the changes in #47, which allocate the structs in native memory.
Can reproduce this issue on Ubuntu with Ros2 Humble and the talker example, removing the
Sleep
call speeds the whole process up.I think it is somehow caused by the garbage collector since removing all calls to
Shutdown
does not fix this issue while callingGC.TryStartNoGCRegion
(orGC.GetGCMemoryInfo
, I dont know why) seem to prevent it.Furthermore, the issue does not occur using the changes in #47, which allocate the structs in native memory.
Hi Deric,
According to your suggestion, I revert my changes on listener and talker example. After launching program, it's running smoothly for over 5 hours. It seems that my changes caused the issue, and I don't know why... Thanks for your responding!
Nick
Hi, I was able to reproduce the error with the normal talker example included in this repository, which means the error is not your fault and still present but it seems it is triggered erratically. I try to find out what exactly is causing it.
While I am not 100% certain I think it is because of the garbage collector moving the rcl_context_t
struct since almost always the error occurs when this happens (on my machine).
The invalid context is not picked up by Ros2cs.Ok()
which is probably because after the move the publisher struct contains the old address now pointing to somewhere in memory (for which rcl_context_is_valid
is undefined) while the call to rcl_context_is_valid
in Ros2cs.Ok()
receives the updated one of the still valid context.
Also, it is possible to call Ros2cs.Shutdown()
after such a move and keep publishing by removing the shutdown checks in Publisher.Publish
and hoping that the old memory location has not been touched since.
@Nickiven was this issue resolved for you?
OS: Ubuntu22.04 ROS2 Humble .NET 6.0
Hi, I have modified example "ROSTalker" and "ROSListener" files to implement these two nodes can send and receive data at the same time. Details as below: After build and launch, everything goes well. But 20mintues later, I get an exception as below: Please Help. Thanks.