-
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
Fix matched event issues #683
Conversation
There is a problem on take_event. In get_publication_matched_status(), current_count_change and total_count_change will be set as 0. eturnCode_t DataWriterImpl::get_publication_matched_status(
PublicationMatchedStatus& status)
{
if (writer_ == nullptr)
{
return ReturnCode_t::RETCODE_NOT_ENABLED;
}
{
std::unique_lock<RecursiveTimedMutex> lock(writer_->getMutex());
status = publication_matched_status_;
publication_matched_status_.current_count_change = 0;
publication_matched_status_.total_count_change = 0;
}
user_datawriter_->get_statuscondition().get_impl()->set_status(StatusMask::publication_matched(), false);
return ReturnCode_t::RETCODE_OK;
} While calling take_event after matched event happen, it will call get_publication_matched_status() to get status. At this time, current_count_change and total_count_change are already set as 0. So I think if change may be as below (Only avoid triggering event)
|
@Barry-Xu-2018 I think you are right! Updated the code in 0c60ec2 |
CC: @iuhilnehc-ynos |
@MiguelCompany can you address cpplint warning? |
I tried to run matched demo and find a new problem. It seems repeated event was received. ros2 run demo_nodes_cpp matched_event_detect
[INFO] [1680752983.277148039] [multi_sub_node]: Create a new subscription.
[INFO] [1680752983.278800649] [matched_event_detect_node]: First subscription is connected.
[INFO] [1680752983.278846840] [multi_sub_node]: Create a new subscription.
[INFO] [1680752983.280026632] [matched_event_detect_node]: The changed number of connected subscription is 1 and current number of connected subscription is 2.
[INFO] [1680752983.280062182] [multi_sub_node]: Destroy a subscription.
[INFO] [1680752983.281545152] [matched_event_detect_node]: The changed number of connected subscription is -1 and current number of connected subscription is 1.
[INFO] [1680752983.281580592] [multi_sub_node]: Destroy a subscription.
[INFO] [1680752983.282452240] [matched_event_detect_node]: Last subscription is disconnected.
[INFO] [1680752983.282486114] [multi_pub_node]: Create a new publisher.
[INFO] [1680752983.283396538] [multi_pub_node]: Create a new publisher.
[INFO] [1680752983.284131755] [matched_event_detect_node]: First publisher is connected.
[INFO] [1680752983.284165433] [multi_pub_node]: Destroy a publisher.
[INFO] [1680752983.285238736] [matched_event_detect_node]: The changed number of connected publisher is -1 and current number of connected publisher is 1.
[INFO] [1680752983.285273466] [multi_pub_node]: Destroy a publisher.
[INFO] [1680752983.286016443] [matched_event_detect_node]: Last publisher is disconnected. |
You can use this code to reproduce the problem. While creating or destroying a subscription, publisher get 2 notification of matched event.
Repeated notification is from And repeated notification isn't from |
@MiguelCompany still it still generates the 2 events, is this expected behavior? or we should add if |
@Barry-Xu-2018 @fujitatomoya I think I finally got it right. Please check on your side. |
@MiguelCompany In __rmw_init_event, you change code as the below.
According to my understanding, you don't want to get status notification for matched event. |
Status mask already enable matched. rmw_fastrtps/rmw_fastrtps_cpp/src/publisher.cpp Lines 268 to 272 in 851ced8
Maybe we cannot disable it. rmw_fastrtps/rmw_fastrtps_shared_cpp/src/rmw_wait.cpp Lines 191 to 205 in 851ced8
|
Friendly ping @MiguelCompany |
According to the release schedule of Iron Mon. April 10, 2023 - Alpha + RMW freeze I am not sure whether this problem should be fixed today. |
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
…en set. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
e9004b5
to
dbe3bdf
Compare
@Barry-Xu-2018 @fujitatomoya One last try before using the workaround in #683 (comment). I rebased and changed the way the information of the event is taken, so the status on the entity is always reset. |
@MiguelCompany Thank you. Your change fixed it after testing. |
re-run CI based on #683 (comment) |
rerun CI with my repos which use the latest ros2 with current PR. CI: |
@fujitatomoya @clalancette This bugfix is ready |
An alternative for #682 that should fix #681