Re: Chasing opened (?) file descriptors



On Sep 28, 10:01 am, Emmanuel Frecon <efre...@xxxxxxxxx> wrote:
I have a series of long-running processes (in production) that will
return "too many opened files" from time to time. I am using version
8.4 and 8.5, I can't run 8.6 in production!. These processes use a
mixture of socket connections (both servers and clients) and files
(write and read, including pipes for some of them). A good guess is
that one of the libraries at use forgets to close a socket or file
descriptor at some point. These processes use many libraries, so it's
been hard to track.

I've been thinking of using Tcl's introspection mechanisms to actually
detect where the problem might be. On 8.5, chan names returns the list
of channels. For sockets, the fconfigure command returns enough
information to give some clues as to which one might be the
problematic one. For files, I'm a bit confused since the only thing
that I can think of would be to "override" the open command. Has
somebody any good hints for how to proceed forward? Any code lying
around?

Help greatly appreciated, I'm stucked!

Which OS ? If it's Linux, go to /proc/$PID/fd and do 'ls -l'. The fds
appear as symbolic links, and the target gives the file name for
regular files. For pipes and sockets you get only handles, but you
can nonetheless use them to correlate things:

- to find the PID on other side of the pipe , just grep in `ls -1 /
proc/[0-9]*/fd`
- to find the socket's details, grep in /proc/net/tcp

If it's Windows, ProcessExplorer should also give you detailed info on
all opened handles.

-Alex
.



Relevant Pages

  • Chasing opened (?) file descriptors
    ... I have a series of long-running processes (in production) that will ... mixture of socket connections and files ... These processes use many libraries, ... the fconfigure command returns enough ...
    (comp.lang.tcl)
  • Re: Chasing opened (?) file descriptors
    ... return "too many opened files" from time to time. ... mixture of socket connections and files ... These processes use many libraries, ... the fconfigure command returns enough ...
    (comp.lang.tcl)
  • Re: General Linux c programming questions
    ... Socket API is included in the standard C library. ... The OP will also find that Winsock is very similar to the standard ... For many years Microsoft stubbornly pretended that TCP/IP ... third-party TCP/IP libraries from Sun, Wollongong, and others ...
    (comp.os.linux.misc)
  • Programming Sockets with a Secure Layer
    ... I've been programming for quite a while and I've tried playing with ... libraries I could use to have a Secure Socket Layer on top of my ... using a protocol of my own. ...
    (comp.os.linux.networking)
  • Re: Linking Error
    ... maybe you have a compile error since you miss some include for the socket functions. ... the libraries should already be linked into vxworks itself and the linking process is part of the loading process. ... getting error of undefined reference to socket(), bind,sendto, ... Is it really linking error? ...
    (comp.os.vxworks)