This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: ServerSocket::accept
- From: Michael Koch <konqueror at gmx dot de>
- To: java at gcc dot gnu dot org
- Cc: Eric Wong <wongsinwey at yahoo dot com>
- Date: Tue, 6 Jul 2004 21:03:41 +0200
- Subject: Re: ServerSocket::accept
- References: <20040706160823.26306.qmail@web13206.mail.yahoo.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am Dienstag, 6. Juli 2004 18:08 schrieb Eric Wong:
> Hi,
>
> In version 3.4.0/1, ServerSocket.accept() creates a
> new Socket() and then in the process invoke
> Socket.getImpl(), which goes something like this:
>
> -----
> SocketImpl getImpl() throws SocketException
> try
> {
> if (!implCreated)
> {
> impl.create(true);
> implCreated = true;
> }
> }
> catch (IOException e)
> {
> throw new SocketException(e.getMessage());
> }
>
> return impl;
> -----
>
> But create(true) alone will cause
> natPlainSocketImplPosix.cc (depending on the platform)
> to create a fresh yet never-been-used socket
>
> descriptor. As a result, lsof will show:
> > socktest 31812 root 8u sock 0,0 1364355 can't
>
> identify protocol
>
> So each ServerSocket.accept() call will generate
> additional descriptor until we get EMFILE error ("Too
> many open files").
>
> (At first, i thought the run-out-of-file-descriptors
> issue has got something to do with proper socket
> closures!)
I fixed this bug for 3.5. I will provide a a patch for 3.4 soon.
Michael
- --
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFA6veNWSOgCCdjSDsRAskSAKCPs8kdWCS6fYmxtQT+J0vOAm4vOACgmFdV
hgLZM2icM/x9GZdATf7bHvY=
=Agq9
-----END PGP SIGNATURE-----