-
Notifications
You must be signed in to change notification settings - Fork 118
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
Sometimes heavy CPU load #749
Comments
After deep investigation, I find why CPU usage is high. While issue occur, rcl_wait() in every thread is constantly awakened by two events: one is the subscription, and the other is the guard_condition. The reason for the error returned by rcl_take() is bool StatefulReader::begin_sample_access_nts(
CacheChange_t* change,
WriterProxy*& wp,
bool& is_future_change)
{
const GUID_t& writer_guid = change->writerGUID;
is_future_change = false;
if (matched_writer_lookup(writer_guid, &wp))
{
SequenceNumber_t seq;
seq = wp->available_changes_max();
if (seq < change->sequenceNumber) // change->sequenceNumber is alwasy bigger than wp->available_changes_max()
// So this is future change. This leads that nothing is taken.
{
is_future_change = true;
}
}
return true;
} About rcl_wait() is constantly awakened, it is related to
void
Executor::execute_any_executable(AnyExecutable & any_exec)
{
...
interrupt_guard_condition_.trigger();
...
} |
Could you help to support this issue ? I add below log,
While the issue occurs, the output as below
|
@Barry-Xu-2018 thanks for creating issue. as far as i tried on my environment, rolling ros2/ros2@30e9231 still also has the problem. that is so unlikely but i did see the problem once in 30 times. the problem is, once this happens it does not go away, it just keeps running the CPU resource and does not get back to normal state. |
@MiguelCompany @EduPonz friendly ping. |
@fujitatomoya We will try to reproduce and investigate this soon. According to the information provided by @Barry-Xu-2018 I think this will only happen with reliable topics. |
@MiguelCompany Thank you for your help.
Yes. BTW, I discovered that the transport never invokes ReceiverResource::OnDataReceived(). |
this does not fix the problem here, but is this supposed to be like this? otherwise, it always returns true... diff --git a/src/cpp/rtps/reader/StatefulReader.cpp b/src/cpp/rtps/reader/StatefulReader.cpp
index ef4a19913..e47c7ced5 100644
--- a/src/cpp/rtps/reader/StatefulReader.cpp
+++ b/src/cpp/rtps/reader/StatefulReader.cpp
@@ -1449,6 +1449,11 @@ bool StatefulReader::begin_sample_access_nts(
is_future_change = true;
}
}
+ else
+ {
+ // if matched writer is not available, remove this from history
+ return false;
+ }
return true;
} |
@Barry-Xu-2018 @fujitatomoya eProsima/Fast-DDS#4696 should address this |
What you suggest was an error that was fixed in eProsima/Fast-DDS#2363. Let me explain: If the reader receives a sample with a correct sequence (i.e. not in the future) from a writer, and the writer is gone before the user takes the sample, we should keep the sample there for the user to take it. What we did in eProsima/Fast-DDS#2363 was to remove all future changes from the reader's history when the writer is unmatched, but keep the already notified changes so they can be taken |
Thank you for your fix. |
Kudos to @Mario-DL who did all the work |
eProsima/Fast-DDS#4696 works like a magic, i confirmed on my local env as well. @Mario-DL @MiguelCompany thanks a bunch 🚀🚀🚀 |
Bug report
Required Info:
Steps to reproduce issue
The reproduced code is located at https://github.com/Barry-Xu-2018/test_pkg.
It will load 60 publishers in different process and one component to run 60 subscribers.
They use the same topic. Each publisher sends a message every second.
Please build it in humble environment
Run
While you terminate program by ctrl + c, shared memory maybe not cleared (Shared memory will be used in this program).
You can do it by manual. (e.g. rm -rf /dev/shm/*)
Sometimes you will see below warning. Please terminate this program, clear /dev/shm and run it again.
Expected behavior
Low CPU load for component process
Actual behavior
Sometimes, you will find heavy CPU load for componet process.
The reproducibility rate varies on different machines.
Additional information
In my environment, if I compile the program with debug version, I find that the issue cannot be reproduced.
I found a simple method to reproduce a similar phenomenon.
After
ros2 launch test_pkg node_to_container.launch.py
, you use gdb attachcomponent_container_isolated
process and then continue to run.Using this method, it's easy to reproduce the issue regardless of whether running the Debug or Release version.
For ROS2 rolling version, I've done more than 30 tests, and I still haven't been able to reproduce this issue. But if I use gdb way, this problem can be reproduced.
The text was updated successfully, but these errors were encountered: