FAQ
Hi,

On recent bleadperls, a call to socket() will leak a file descriptor if
the filehandle has already been opened. For example, the following script
causes the process to die with the message "Too many open files".

while (1) {
socket S, 1, 2, 0 or die $!;
}

The patch below fixes the leak. Not sure if it's the right fix or not,
but all tests still pass. If it is the right fix, then someone should
look at pp_sockpair() too, because at first glance it looks like it might
have the same problem.

Patch is against perl@9359.

Cheers,
-Ben

--
signer: can't create ~/.sig: Broken pipe

--- pp_sys.c.orig Mon Mar 26 13:13:06 2001
+++ pp_sys.c Mon Mar 26 14:20:13 2001
@@ -2205,6 +2205,9 @@
RETPUSHUNDEF;
}

+ if (IoIFP(io))
+ do_close(gv, FALSE);
+
TAINT_PROPER("socket");
fd = PerlSock_socket(domain, type, protocol);
if (fd < 0)

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 3 | next ›
Discussion Overview
groupperl5-porters @
categoriesperl
postedMar 26, '01 at 6:26p
activeMar 26, '01 at 6:45p
posts3
users3
websiteperl.org

People

Translate

site design / logo © 2022 Grokbase