machines-in-motion / real_time_tools

BSD 3-Clause "New" or "Revised" License
9 stars 6 forks source link

unittests "Aborted (core dumped)" #8

Closed MaximilienNaveau closed 5 years ago

MaximilienNaveau commented 5 years ago

During the continuous build we have these kind of issues (see below). Anyone has an idea where this comes from?

build   23-Sep-2019 17:04:49    Warning this thread is not going to be real time.
build   23-Sep-2019 17:04:49    Warning this thread is not going to be real time.
build   23-Sep-2019 17:04:49    Warning this thread is not going to be real time.
build   23-Sep-2019 17:04:49    Warning this thread is not going to be real time.
build   23-Sep-2019 17:04:49    Warning this thread is not going to be real time.
build   23-Sep-2019 17:04:49    Warning this thread is not going to be real time.
build   23-Sep-2019 17:04:49    Warning this thread is not going to be real time.
build   23-Sep-2019 17:04:49    Warning this thread is not going to be real time.
build   23-Sep-2019 17:04:49    Warning this thread is not going to be real time.
build   23-Sep-2019 17:04:49    Warning this thread is not going to be real time.
build   23-Sep-2019 17:04:49    Warning this thread is not going to be real time.
build   23-Sep-2019 17:04:49    [       OK ] threadsafe_timeseries.full_history (19236 ms)
build   23-Sep-2019 17:04:49    [ RUN      ] threadsafe_timeseries.partial_history
build   23-Sep-2019 17:04:49    Warning this thread is not going to be real time.

error 23-Sep-2019 17:04:49 terminate called after throwing an instance of 'std::invalid_argument'

build   23-Sep-2019 17:04:49    Warning this thread is not going to be real time.
build   23-Sep-2019 17:04:49    Warning this thread is not going to be real time.
build   23-Sep-2019 17:04:49    Warning this thread is not going to be real time.

error 23-Sep-2019 17:04:49 what(): you tried to access timeseries element which is too old.

build   23-Sep-2019 17:04:49    Warning this thread is not going to be real time.
build   23-Sep-2019 17:04:49    Warning this thread is not going to be real time.
build   23-Sep-2019 17:04:49    Warning this thread is not going to be real time.
build   23-Sep-2019 17:04:49    Warning this thread is not going to be real time.
build   23-Sep-2019 17:04:49    Warning this thread is not going to be real time.
build   23-Sep-2019 17:04:49    Warning this thread is not going to be real time.
build   23-Sep-2019 17:04:49    Warning this thread is not going to be real time.
error   23-Sep-2019 17:04:52    Aborted (core dumped)
wumanu commented 5 years ago

this means most likely that the thread which reads from the timeseries https://github.com/machines-in-motion/real_time_tools/blob/master/tests/threadsafe_timeseries_test.cpp#L23 is too slow.

i am a bit surprised this happens (even on a non-realtime machine), since the other thread https://github.com/machines-in-motion/real_time_tools/blob/master/tests/threadsafe_timeseries_test.cpp#L117 waits at each iteration, and there is a buffer of 100 in the timeseries https://github.com/machines-in-motion/real_time_tools/blob/master/tests/threadsafe_timeseries_test.cpp#L128.

also, it is weird that this happens now after your changes (they looked ok to me). did you run the tests before and after the changes you made?

MaximilienNaveau commented 5 years ago

You actually start the reader before the publisher no?

wumanu commented 5 years ago

yes, so it seems like the readers for some reason cannot keep up with the publisher

MaximilienNaveau commented 5 years ago

Ok. This error appear only in the docker in Bamboo. On my computer unit-tests when fine before and after my modifications.

MaximilienNaveau commented 5 years ago

Ok, I think the error comes from the fact that you used global variables and that they where not re-initialized between the 2 tests.

wumanu commented 5 years ago

i don't see what you mean, at the beginning of each test the inputs are initialized and the timeseries is initialized, right?

MaximilienNaveau commented 5 years ago

Solution: to the problem, increase the sleeping duration in the slow thread