Re: /proc/net/tcp not updated fast enough?

From: Herbert Xu (herbert_at_gondor.apana.org.au)
Date: 10/27/04

  • Next message: Jan Kasprzak: "Re: [PATCH] NFS mount hang fix"
    To: grove@fsr.ku.dk (Henrik Christian Grove)
    Date:	Wed, 27 Oct 2004 22:15:13 +1000
    
    

    Henrik Christian Grove <grove@fsr.ku.dk> wrote:
     
    > I have it running on 11[1] machines and since midnight (it's 11:47 here
    > now) I have 2397 succesfull connections, but in 31 cases (that's 1,29%
    > of the connections - and thus not totally ignorable) I had to read
    > through /proc/net/tcp twice to find the uid. Does that sound plausible,
    > or more like I'm doing something wrong?

    /proc/net/tcp in 2.4 is inherently unreliable since it doesn't use
    the seqfile interface. Your best bet is to use the tcp_diag interface
    instead. You can either do that by using the ss command from the
    iproute2 suite, or you can query tcp_diag directly from C through
    netlink.

    The latter should be 100% reliable if you do a get instead of a dump.

    > If it's plausible, how long can it take for /proc/net/tcp to get the
    > info? I'm asking because I see one connection (again since midnight)
    > where I don't find any uid in the 5 attempts I do as a max.

    It's not that it takes a long time to update /proc/net/tcp, it's
    the fact that you have to read /proc/net/tcp in pieces, and when
    the underlying data is changing, the 2.4 code is much more prone to
    returning things twice or missing entries altogether.

    Cheers,

    -- 
    Visit Openswan at http://www.openswan.org/
    Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
    Home Page: http://gondor.apana.org.au/~herbert/
    PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: Jan Kasprzak: "Re: [PATCH] NFS mount hang fix"

    Relevant Pages

    • Re: file as a directory
      ... And network connections, and pipes are files ... You can't just go around pretending an element in an array is the ... recursion _has_ to stop somewhere. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: ip contrack problem, not strictly followed RFC, DoS very much possible
      ... > otherwise idle session, you nuke a perfectly good idle session for reasons ... Shouldn't it be protocols thingie to take care about connections? ... This value as it is now, keeps too many connections in memory, which often leads ... To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ ...
      (Linux-Kernel)
    • Re: oops reiserfs / kernel
      ... > The server has started to refuse all connections after several days of ... After a reboot it worked well during 5 hours ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: epoll reporting events when it hasnt been asked to
      ... > I don't normally see this behaviour for most connections, ... the user sets the event mask to zero, it can still know when something ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH] b44.c box lockup fix (netconsole): ratelimit NAPI poll error message
      ... connections from dialup hosts not accepted. ... More majordomo info at http://vger.kernel.org/majordomo-info.html ... Please read the FAQ at http://www.tux.org/lkml/ ...
      (Linux-Kernel)