Robot Operating System(ROS), ROSOUT leak file descriptors

85 views Asked by At

Why rosout node costs more than a thousand file descriptors.With lsof -p <pid of rosout>, nearly a thousand FD are "can't identify protocol", any solutions?

enter image description here

1

There are 1 answers

0
Exia On

The problem is caused by a ros node shut down by exception.

I test a very simple code snippet:

import rospy
import rosnode
import time

if __name__=="__main__":
    rospy.init_node("test")
    rospy.signal_shutdown("an exception")

I found that each time the code is executed, a leak of file descriptor is created, thus I assume that the reason is a node is shutdown before the socket connection between the node with the "rosout" node completed. The following code(might a bit of tricky) fixed the mentioned bug:

import rospy
import rosnode
import time

if __name__=="__main__":
    rospy.init_node("test")
    sleep(1)
    rospy.signal_shutdown("an exception")