[Home]

Summary:ASTERISK-05939: [patch] asterisk.c::listener() descriptor leak
Reporter:Luigi Rizzo (rizzo)Labels:
Date Opened:2005-12-31 08:14:33.000-0600Date Closed:2006-04-11 16:59:25
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) listener2.diff
Description:asterisk.c::listener() will leak descriptors if the ast_pthread_create()
following a successful socketpair() call fails: the two sockets are never
closed, thus consuming the descriptor space.
While not fatal, it may eventually exhaust the available descriptor space.

The trivial patch is to add a couple of close() calls in the block
that handles ast_pthread_create() failures:
+                       close(consoles[x].p[0]);
+                       close(consoles[x].p[1]);

However, I would suggest applying the attached patch that, in addition
to the fix, also rewrites the main loop in a more streamlined,
thus hopefully more readable, way.
Comments:By: Olle Johansson (oej) 2006-01-04 14:16:42.000-0600

Please remove the // commented lines...

/Olle

By: Russell Bryant (russell) 2006-01-04 22:48:15.000-0600

This patch also includes the "show threads" CLI command.  :)

By: Luigi Rizzo (rizzo) 2006-01-05 04:42:21.000-0600

here you go.

By: Olle Johansson (oej) 2006-01-30 14:14:00.000-0600

Assigning this to markster in the hope that either Mark or Kevin will take a look at this...

/Housekeeping

By: Tilghman Lesher (tilghman) 2006-04-11 16:59:25

Simpler fix committed to 1.2, and merged to trunk.