Closed thorstink closed 6 years ago
If I give combine_latest_with()
an own thread, it does not seem to occur. (it ran without crashing for over 12 hours now..)
Maybe I also should have emphasized that I am putting a semi-random sleep in inertial_odom.cmd(linear_velocity);
(that often exceeds the 100ms) to sort of simulate the case when a simulation takes too long. This seemed to improve the reproducibility of the bug.
So I guess the issue might lie in when there are too many tasks on a stack or something; I have no idea.
Hi! Thank you for all the detail. Your solution is correct. Operators that combine multiple inputs from different threads must specify a thread-safe coordinator/scheduler. Specifing a new thread coordinator to with_latest_from would fix the issue that you documented. It does not have to be a new thread though. There are ways to reuse threads across multiple operators.
Yes indeed, I used some rx-thread that was already there. Issue can be closed as far as I am concerned.
There is still much to learn for me in the realms of this frp, rx and applying it to mobile robots, so much fun though :-)
Hi again :)
I am afraid I stumbled upon a rather complex bug (or I just do not know what I am doing). I will do my best to explain and document this as well as I can, however, if you need anything specific, please let me know. I think I have checked all the obvious source for this error, no obvious unjoined/detached threads, examined the backtrace after a crash (which is definitely outside my comfort zone and or skill set). As far as I understand it, it seems to with_latest_from().
I can not create a minimum example that reproduces the bug at the moment, so I hope I am clear enough through my writing and documentation.The bug however, is persistent, occurs always after a random time.
The application fuses multiple sources of information to estimate the motion of a robot and also optimizes the motion-model while doing so. The application eventually crashes with the note:
terminate called without an active exception
. Sometimes it happens within 5 minutes, sometimes it takes up to 2 hours for the bug to appear. There is a shared library that defines a class which has acpp rxcpp::subjects::subject<msg>
public member variable. In the main application there is a class-instantiation of this class,auto driver = driver()
and then the observable is exposed though, e.g.:auto info_source = driver.subject_.get_observable()
.Somewhere further in the main application, the info_source is merged with the output of a complex computation, in the subscription to the merged stream the info it published on a middleware-publisher (in this case ROS's middleware implementation), so in pseudo-pseudo-cpp:
The backtrace, which shows more stuff, because the actual application has a bit more stuff going on..
Using gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0 and set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_FLAGS "-g")