[nanomsg] Re: tracking down pipe/anon inode leaks

  • From: Garrett D'Amore <garrett@xxxxxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Fri, 23 Jan 2015 15:53:57 -0800

DTrace on MacOS might help you figure out the origination.  Are these unix 
domain sockets?  If so, it wouldn’t surprise me if you have code that is nuking 
an existing socket path, while an underlying server / thread still has the file 
descriptor open.

I’ve not figured out a way to deal with stale UNIX domain sockets that is 100% 
race free, sadly.  I think cleaning up in startup scripts is probably the only 
reasonable way to deal with it.  (Or SMF scripts for illumos/Solaris.  Not sure 
what the systemd equivalent would be…)

        - Garrett

> On Jan 23, 2015, at 3:20 PM, Jason E. Aten <j.e.aten@xxxxxxxxx> wrote:
> 
> Does anyone have tips or tricks for tracking down leaking file descriptors?  
> According to lsof, they appear to be pipes (OSX) and "anonymous inodes" 
> (Linux).  Any suggestions? I'm at a loss.
> 
> Details: I'm using push/pull nanomsg (updated yesterday; most recent from 
> github) sockets between a client and a server. It looks like every client 
> connection to the server results in the server leaking more file descriptors. 
> On OSX, I see pipes left open. condensed "lsof -p 34334 -Fnt" output shows 
> these are leaked (OSX):
> 
> tPIPE:n->0x95df5be7a4700aff
> 
> tPIPE:n->0x95df5be7a46fee1f
> 
> tPIPE:n->0x95df5be79ddeb75f
> 
> tPIPE:n->0x95df5be7a16570df
> 
> tPIPE:n->0x95df5be7a165702f
> 
> tPIPE:n->0x95df5be79ddeae6f
> 
> tPIPE:n->0x95df5be7a47006df
> 
> tPIPE:n->0x95df5be7ada5a0ff
> 
> tPIPE:n->0x95df5be7a165912f
> 
> tPIPE:n->0x95df5be7a46ff0df
> 
> tPIPE:n->0x95df5be7ac4c2ecf
> 
> tPIPE:n->0x95df5be7ac4c499f
> 
> tPIPE:n->0x95df5be7a470041f
> 
> tPIPE:n->0x95df5be7ac4c554f
> 
> tPIPE:n->0x95df5be7a46ffbdf
> 
> tPIPE:n->0x95df5be7a46ff39f
> 
> tPIPE:n->0x95df5be7a46fe94f
> 
> tPIPE:n->0x95df5be7a165a1af
> 
> tPIPE:n->0x95df5be7a470057f
> 
> tPIPE:n->0x95df5be7a46fe68f
> 
> On Linux it is anonymous inodes that are leaking. Output from "lsof -p 2332 
> -Fnt": 
> 
> 
> 
> t0000:nanon_inode
> 
> t0000:nanon_inode
> 
> t0000:nanon_inode
> 
> t0000:nanon_inode
> 
> t0000:nanon_inode
> 
> t0000:nanon_inode
> 
> t0000:nanon_inode
> 
> t0000:nanon_inode
> 
> t0000:nanon_inode
> 
> 
> t0000:nanon_inode
> 
> 
> 

Other related posts: