Hi : (Apology if this is too naive question.) Our system is running out of FDs frequently and I would like to trace which process takes FDs and does not close it. One suspicion is that many DNS connection are made to the system which are never closed. To do this I wrote simple dtrace script; --- syscall::open*:entry { printf("FD opened > %s[%d(pid),%d(tid)], %-60s\t\t%Y\n",execname,pid,tid,copyinstr(arg0),walltimestamp); } syscall::open*:return { printf("FD closed < %s[%d(pid),%d(tid)],errno=%d,arg=%d\n",execname,pid, tid,errno,arg0); } --- Q: - would this capture all of the FD traffic including DNS?? - Is there any other way I can improve this script to achieve my objectives? How do I aggregate total number of FDs taken by all process at one given time? We are not looking for netstat or snoop solution. Thanks, -Shanya
pfiles `pgrep .` (as root) will show all open file descriptors by all processes. If you are running out of open ports -- maybe "netstat -an" is what you want. On Wed, Dec 29, 2010 at 9:04 PM, Shanya Jones <shanya_jones at yahoo.com> wrote:> Hi : > > ?(Apology if this is too naive question.) > ?Our system is running out of FDs frequently and I would like to trace which process takes FDs and does not close it. ?One suspicion is that many DNS connection are made to the system which are never closed. > To do this I wrote simple dtrace script; > --- > syscall::open*:entry > { > ? ? ? ?printf("FD opened > %s[%d(pid),%d(tid)], %-60s\t\t%Y\n",execname,pid,tid,copyinstr(arg0),walltimestamp); > } > > syscall::open*:return > { > ? ? ? ?printf("FD closed < %s[%d(pid),%d(tid)],errno=%d,arg=%d\n",execname,pid, > tid,errno,arg0); > } > --- > Q: > - would this capture all of the FD traffic including DNS?? > - Is there any other way I can improve this script to achieve my objectives? ?How do I aggregate total number of FDs taken by all process at one given time? > ?We are not looking for netstat or snoop solution. > > Thanks, > ?-Shanya > > > > > > > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org >-- Theo Schlossnagle http://omniti.com/is/theo-schlossnagle
>Hi : > > (Apology if this is too naive question.) > Our system is running out of FDs frequently.What is the exact symptom or error message? There is no limit on the global number of file descriptors (assuming you''re using Solaris) Casper
Hi Casper: ? It is one of our application that is giving error.? We want to determine if it the application that is using too many FDs or the system(Solaris 10)or DNS that is using FDs.? We want to find out which process is using how many FDs using dtrace at give point and time - not lsof nor netstat, pfiles not snoop either, using none of the system commands. Thanks, ? -Shanya --- On Thu, 12/30/10, Casper.Dik at Sun.COM <Casper.Dik at Sun.COM> wrote:> From: Casper.Dik at Sun.COM <Casper.Dik at Sun.COM> > Subject: Re: [dtrace-discuss] Tracing FDs > To: "Shanya Jones" <shanya_jones at yahoo.com> > Cc: dtrace-discuss at opensolaris.org > Date: Thursday, December 30, 2010, 5:43 AM > > >Hi : > > > >? (Apology if this is too naive question.) > >? Our system is running out of FDs frequently. > > What is the exact symptom or error message? > > There is no limit on the global number of file descriptors > (assuming > you''re using Solaris) > > Casper > >
On Wed, Jan 5, 2011 at 06:04, Shanya Jones <shanya_jones at yahoo.com> wrote:> Hi Casper: > > ? It is one of our application that is giving error.? We want to determine if it the application that is using too many FDs or the system(Solaris 10)or DNS that is using FDs.perhaps you want to show the *exact* error you''re getting, and describe the circumstances in some detail? As Casper said, there''s no system-wide limit on file descriptors, so if a specific process is running out of fds (that''s what I''m assuming is happening from what I''ve seen so far), then it''s that process that''s exceeding its limit - see "ulimit(1)" man-page.> We want to find out which process is using how many FDs using dtrace at give point and time - not lsof nor netstat, pfiles not snoop either, using none of the system commands.is this an academic exercise. or a real-world problem? if the latter, use the tool for the problem not the tool of your fancy :-) again. assuming it''s an open() system call that''s returning the error we''re discussing here in the abstract, using a probe looking something like pid$target:libc:open:return /arg1 == -1 && errno == 24/ { ustack(); } (but check the man pages and do some testing, I didn''t check all the details) will tell you a lot of where the specific error happens, but it may not help pinpoint the code that''s "wasting" the fds, since it''s going to be the one that happens to trip over the limit, nothing more. HTH Michael> > Thanks, > ? -Shanya > > --- On Thu, 12/30/10, Casper.Dik at Sun.COM <Casper.Dik at Sun.COM> wrote: > >> From: Casper.Dik at Sun.COM <Casper.Dik at Sun.COM> >> Subject: Re: [dtrace-discuss] Tracing FDs >> To: "Shanya Jones" <shanya_jones at yahoo.com> >> Cc: dtrace-discuss at opensolaris.org >> Date: Thursday, December 30, 2010, 5:43 AM >> >> >Hi : >> > >> >? (Apology if this is too naive question.) >> >? Our system is running out of FDs frequently. >> >> What is the exact symptom or error message? >> >> There is no limit on the global number of file descriptors >> (assuming >> you''re using Solaris) >> >> Casper >> >> > > > > > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org >-- regards/mit freundlichen Gr?ssen Michael Schuster