# [ros2] shutdown [closed]

Hi,

I am working on a code that contains only 1 main node which creates multiple publishers and subscribers.

Because of this and many other reasons, I am using the not_composable method.

The issue I am having now is that the node takes a while to close. If I run the code multiple times in a short duration, the same node is constantly being created. I am calling the rclcpp::shutdown(); every time the program closes but, the node does not immediately shutdown.

I created a simple code to replicate what I am experience.

std::shared_ptr<rclcpp::Node> master_node;

int main(){
rclcpp::init(0, nullptr);
master_node = std::make_shared<rclcpp::Node>("MasterNode");

rclcpp::shutdown();
return 0;
}


So, My question is: Is there a way to force the node to shutdown. Or is there a reason why the node can still be seen using ros2 node list after being shutdown?