Skip to content

Context destructor not being called #893

@ivanpauno

Description

@ivanpauno

Bug report

Required Info:

  • Operating System:
    • Ubuntu 18.04
  • Installation type:
    • from source
  • Version or commit hash:
    • current master
  • DDS implementation:
    • Fast-RTPS (should be DDS implementation agnostic)
  • Client library (if applicable):
    • rclcpp

Steps to reproduce issue

Expected behavior

The log should be printed after ctrl-c.

Actual behavior

It's never printed.

static DefaultContext::SharedPtr default_context = DefaultContext::make_shared();
return default_context;

For some reason, the destructor of the static variable is not being call.

Additional information

I realized of this while working in ros2/rmw_fastrtps#312.
I'm removing the participant from the domain when the context is destructed.
If that doesn't happen, other Participants will not immediately detect that it's not more available (Participant disposal is much slower than removal).

May be related with https://stackoverflow.com/questions/38510621/destructor-of-a-global-static-variable-in-a-shared-library-is-not-called-on-dlcl, as the example is written as a component https://github.com/ros2/demos/blob/master/demo_nodes_cpp/src/topics/talker.cpp.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions