Reputation: 2551
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?
Upvotes: 0
Views: 89
Reputation: 2551
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")
Upvotes: 1