Skip to content

Crash when rcl_timer_reset is called #208

@amfern

Description

@amfern

Describe the bug
When I call rcl_timer_reset on a timer, microros will crash

Additional context
I tracked the issue to the "Static operation" commit cb4f522.

And I tracked it down the crash to rmw_trigger_guard_condition at line

Before the "static operation" commit rmw_create_guard_condition() would allocate the data field dynamiclly and doing so again, does fix the crash. so the function looks, like this:

rmw_guard_condition_t *
rmw_create_guard_condition(
  rmw_context_t * context)
{
  (void)context;

  rmw_uxrce_mempool_item_t * memory_node = get_memory(&guard_condition_memory);
  if (!memory_node) {
      // POI - it fails here.. it retuns here NULL
    RMW_SET_ERROR_MSG("Not available memory node");
    return NULL;
  }
  rmw_uxrce_guard_condition_t * aux_guard_condition =
    (rmw_uxrce_guard_condition_t *)memory_node->data;
  aux_guard_condition->hasTriggered = false;
  aux_guard_condition->rmw_guard_condition.context = context;
  aux_guard_condition->rmw_guard_condition.implementation_identifier =
    rmw_get_implementation_identifier();

+  aux_guard_condition->rmw_guard_condition.data = (bool *)rmw_allocate(sizeof(bool));
+  bool * hasTriggered = (bool *)aux_guard_condition->rmw_guard_condition.data;
+  *hasTriggered = false;

  return &aux_guard_condition->rmw_guard_condition;
}

Although I understand it's not the appropriate fix, but I hope it will be enough information for you to confirm this bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions