ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Rosout leaks file descriptors

asked 2016-12-19 21:34:17 -0500

nansmallgong gravatar image

It is weird that when I launch my ros program my os alert "too many files open". By using "lsof", I found rosout node has numerous sockets with "can't identify protocol"(as the following img shows). How did this happen?

image description

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-12-20 23:42:05 -0500

ahendrix gravatar image

Since these are socket file descriptors, it looks like rosout has a lot of open sockets. ROS creates a socket for each connection between a publisher and a subscriber, so there can be a lot of file descriptors involved, but even on robots with hundreds of nodes this isn't usually a problem.

You may be able to tell what these open sockets are connected to and what state they're in with netstat -lp. The -l option lists open sockets, and the -p option lists the process that owns that socket.

edit flag offensive delete link more


the problem is caused by rosout do not release file descriptor correctly when a node exit with any error. As what I describe here

nansmallgong gravatar image nansmallgong  ( 2016-12-21 00:04:21 -0500 )edit

I had some time to dig into this more deeply and have a proposed fix here:

ahendrix gravatar image ahendrix  ( 2017-11-02 00:56:44 -0500 )edit

Question Tools



Asked: 2016-12-19 21:34:17 -0500

Seen: 426 times

Last updated: Dec 20 '16