Skip to content

Commit

Permalink
Do not crash Executor when send_response fails due to client failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauro Passerino committed Aug 24, 2023
1 parent c1ce5c5 commit d6c2de6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions rclcpp/include/rclcpp/service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,15 @@ class Service
{
rcl_ret_t ret = rcl_send_response(get_service_handle().get(), &req_id, &response);

if (ret == RCL_RET_TIMEOUT) {
RCLCPP_WARN(
node_logger_.get_child("rclcpp"),
"failed to send response to %s (timeout): %s",
this->get_service_name(), rcl_get_error_string().str);
rcl_reset_error();
return;
}

if (ret != RCL_RET_OK) {
rclcpp::exceptions::throw_from_rcl_error(ret, "failed to send response");
}
Expand Down

0 comments on commit d6c2de6

Please sign in to comment.