Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Mar 2012 10:15:59 +0100
From:      Matthew Seaman <matthew@FreeBSD.org>
To:        freebsd-stable@FreeBSD.org
Subject:   Re: Too many open files
Message-ID:  <4F7033CF.6000308@FreeBSD.org>
In-Reply-To: <20120326085640.GB5335@home.opsec.eu>
References:  <a8f31306b066f86beabc61fce1e2b5fb.squirrel@mail.digital-infotech.net> <CADGWnjWTNviAyfReZ-fy0rhF=DKsA57rCscYtsU=v25rTMq5Xw@mail.gmail.com> <4F7019FC.4090907@ShaneWare.Biz> <4660483b96cf883fd66b46f4578d1def.squirrel@mail.digital-infotech.net> <20120326085640.GB5335@home.opsec.eu>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig58A8A09048353A7D69848B96
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 26/03/2012 09:56, Kurt Jaeger wrote:
>>>  From knowing that you have too many files open you can increase the
>>> > > maxfile numbers - but if you want to know what uses them try this=
 -
>>> > >
>>> > > lsof -n | awk '{print $2 "\t" $1}' | sort | uniq -c | sort
> On my system, it shows interesting numbers for firefox-instances:
>=20
> 3895 4150       firefox-b
> 4160 72958      firefox-b
> 4240 3594       firefox-b
> 4320 4232       firefox-b
> 4431 89391      firefox-b
>=20
> This seems to come from threads, where lsof shows the same
> descriptor as open for multiple times, even if it comes from the
> same process memory.
>=20
> For example for pid 4232:
>=20
> lsof -n | grep icon-theme.cache | grep 4232 | wc -l
>=20
> firefox-b  4232         pi  txt     VREG              0,102            =
  10784  924293 /usr/local/share/icons/hicolor/icon-theme.cache
>=20
> This happens on 8.1-REL-p5 amd64. So the method is not fail-safe
> for the real number of open files.
>=20

Does 'procstat -fa' give better results for you?

It seems to be one of those little hidden secrets that FreeBSD comes
with a bunch of native applications that provide pretty much equivalent
functionality to lsof(1).  See: fstat(1), procstat(1), sockstat(1).

Which is odd, given that since these sort of applications have to read
and interpret kernel memory -- an action for which there isn't a nice
well defined ABI -- the application has to be kept rigorously in synch
with the kernel it is used against.  Something that is intrinsically
easier to do when kernel and application are compiled at the same time
and from the same source tree.

	Cheers,

	Matthew

--=20
Dr Matthew J Seaman MA, D.Phil.
PGP: http://www.infracaninophile.co.uk/pgpkey



--------------enig58A8A09048353A7D69848B96
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.16 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk9wM9gACgkQ8Mjk52CukIyKdgCghatb6YnDZqEyRZnKFQ9Fk9jJ
iPIAn0Hu7ziAHoy5WIjVztQHDllRQ1TL
=uVTP
-----END PGP SIGNATURE-----

--------------enig58A8A09048353A7D69848B96--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F7033CF.6000308>