Skip to content
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

Found incoherent method calls in rmw_create_subscription. #647

Closed
Oscarchoi opened this issue Dec 6, 2022 · 6 comments
Closed

Found incoherent method calls in rmw_create_subscription. #647

Oscarchoi opened this issue Dec 6, 2022 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@Oscarchoi
Copy link
Contributor

Bug report

In the following snippet of code, associate_reader(…)(line:104) and dissociate_writer(…)(line:114) do not correspond to each other.

// Update graph
std::lock_guard<std::mutex> guard(common_context->node_update_mutex);
rmw_dds_common::msg::ParticipantEntitiesInfo msg =
common_context->graph_cache.associate_reader(
info->subscription_gid_, common_context->gid, node->name, node->namespace_);
rmw_ret_t rmw_ret = rmw_fastrtps_shared_cpp::__rmw_publish(
eprosima_fastrtps_identifier,
common_context->pub,
static_cast<void *>(&msg),
nullptr);
if (RMW_RET_OK != rmw_ret) {
rmw_error_state_t error_state = *rmw_get_error_state();
rmw_reset_error();
static_cast<void>(common_context->graph_cache.dissociate_writer(
info->subscription_gid_, common_context->gid, node->name, node->namespace_));
rmw_ret = rmw_fastrtps_shared_cpp::destroy_subscription(
eprosima_fastrtps_identifier, participant_info, subscription);
if (RMW_RET_OK != rmw_ret) {
RMW_SAFE_FWRITE_TO_STDERR(rmw_get_error_string().str);
RMW_SAFE_FWRITE_TO_STDERR(" during '" RCUTILS_STRINGIFY(__function__) "' cleanup\n");
rmw_reset_error();
}
rmw_set_error_state(error_state.message, error_state.file, error_state.line_number);
return nullptr;

Considering that rmw_ds_common::GraphCache separates the gid storage of readers and writers, I think it has to dissociate the reader that was associated right above. In rmw_create_publisher(...), the corresponding counterpart of the codes, the associated writer is dissociated when publishing fails.

I think it should be modified as follows. Oscarchoi@e997378 If the existing code is not intended, is it okay to PR the above changes?
By the way, the test code assumes that rmw_create_subscription will always succeed, so this fallback code has no effect.

@fujitatomoya
Copy link
Collaborator

I think it should be modified as follows. Oscarchoi@e997378 If the existing code is not intended, is it okay to PR the above changes?

@MiguelCompany i think this is a bug, can you confirm?

@fujitatomoya fujitatomoya added the bug Something isn't working label Dec 6, 2022
@Oscarchoi
Copy link
Contributor Author

I fixed formattings: Oscarchoi@7631039

@MiguelCompany
Copy link
Contributor

@fujitatomoya I think @Oscarchoi is right, and the proposed changes seem correct.

@fujitatomoya fujitatomoya self-assigned this Dec 9, 2022
@fujitatomoya
Copy link
Collaborator

@Oscarchoi as @MiguelCompany mentioned, this needs to be fixed as bug. Could you create PR with using your fix? I am happy to review 👍

@Oscarchoi
Copy link
Contributor Author

Thank you both for confirmation! 😃
I'll create PR soon and notify you.

Oscarchoi added a commit to Oscarchoi/rmw_fastrtps that referenced this issue Dec 10, 2022
Signed-off-by: Wooyoung Choi <wy.choi@naverlabs.com>
fujitatomoya pushed a commit that referenced this issue Dec 12, 2022
Signed-off-by: Wooyoung Choi <wy.choi@naverlabs.com>
mergify bot pushed a commit that referenced this issue Dec 12, 2022
Signed-off-by: Wooyoung Choi <wy.choi@naverlabs.com>
(cherry picked from commit b56cd5f)
mergify bot pushed a commit that referenced this issue Dec 12, 2022
Signed-off-by: Wooyoung Choi <wy.choi@naverlabs.com>
(cherry picked from commit b56cd5f)

# Conflicts:
#	rmw_fastrtps_shared_cpp/src/rmw_subscription.cpp
fujitatomoya pushed a commit that referenced this issue Dec 12, 2022
Signed-off-by: Wooyoung Choi <wy.choi@naverlabs.com>
(cherry picked from commit b56cd5f)
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
quarkytale pushed a commit that referenced this issue May 17, 2023
…652)

(cherry picked from commit b56cd5f)

Signed-off-by: Wooyoung Choi <wy.choi@naverlabs.com>
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
Co-authored-by: Oscarchoi <wychoi502@gmail.com>
@clalancette
Copy link
Contributor

This was fixed by #649 , so closing this out.

fujitatomoya pushed a commit that referenced this issue Sep 5, 2023
Signed-off-by: Wooyoung Choi <wy.choi@naverlabs.com>
(cherry picked from commit b56cd5f)
fujitatomoya pushed a commit that referenced this issue Sep 5, 2023
…651)

Signed-off-by: Wooyoung Choi <wy.choi@naverlabs.com>
(cherry picked from commit b56cd5f)

Co-authored-by: Oscarchoi <wychoi502@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants