Skip to content

Commit 35523a5

Browse files
Janosch MachowinskiJanosch Machowinski
authored andcommitted
fix: added workaround for call to double calls to take_data
This adds a workaround for a known bug in the executor in iron. Signed-off-by: Janosch Machowinski <[email protected]>
1 parent 469f5cd commit 35523a5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

rclcpp_action/src/server.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,10 @@ ServerBase::take_data()
273273
{
274274
size_t next_ready_event = pimpl_->next_ready_event.exchange(ServerBaseImpl::NO_EVENT_READY);
275275

276-
if (next_ready_event == ServerBaseImpl::NO_EVENT_READY;) {
277-
throw std::runtime_error("ServerBase::take_data() called but no data is ready");
276+
if (next_ready_event == ServerBaseImpl::NO_EVENT_READY) {
277+
// there is a known bug in iron, that take_data might be called multiple
278+
// times. Therefore instead of throwing, we just return a nullptr as a workaround.
279+
return nullptr;
278280
}
279281

280282
return take_data_by_entity_id(next_ready_event);
@@ -363,7 +365,9 @@ void
363365
ServerBase::execute(std::shared_ptr<void> & data_in)
364366
{
365367
if (!data_in) {
366-
throw std::runtime_error("ServerBase::execute: give data pointer was null");
368+
// workaround, if take_data was called multiple timed, it returns a nullptr
369+
// normally we should throw here, but as an API stable bug fix, we just ignore this...
370+
return;
367371
}
368372

369373
std::shared_ptr<ServerBaseData> data_ptr = std::static_pointer_cast<ServerBaseData>(data_in);

0 commit comments

Comments
 (0)