[asterisk-dev] streamfile reference counting debug

Mark Michelson mmichelson at digium.com
Mon Apr 20 15:26:34 CDT 2009


Paul Albrecht wrote:
> Hi,
> 
> I'm maintaining an asterisk module, a hacked appconference, which I've
> migrated to asterisk 1.6. Since I've updated the module, I've noticed
> the conference application fails after running for some time because it
> has reached the process limit for open file descriptors. It appears that
> the module burns a file descriptor whenever a sound is played to a
> conference member.

This sounds remarkably similar to a bug that has been fixed already:

The bug:
http://bugs.digium.com/view.php?id=14384

The fix was made in revision 173354 of Asterisk trunk, and was merged in 
subsequent revisions to all 1.6 branches.

What branch of 1.6 are you using? Is your checkout older than 4 Feb from this 
year? If so, it should be updated so that it contains the changes made for the 
issue I linked to above.

> 
> Specifically, when the module plays a sound to a conference member, it
> opens the sound file, processes the file for that member, and then
> closes the file. I can see the file is still open after the module
> finishes playing the sound and closes the file by listing open file
> descriptors with this command: "lsof -c asterisk." I also see that the
> object count is incremented by one when I do "astobj2 show stats" at the
> asterisk command line.
> 
> How can I debug this problem?
> 

Debugging refcount issues is a bit tricky, especially when it comes to debugging 
a reference leak. I suggest reading the section in astobj2.h titled "DEBUGGING 
REF COUNTS BIBLE." Note that if you are using Asterisk 1.6.0, then this section 
is not included and the reference count debugging is not present either.

Mark Michelson



More information about the asterisk-dev mailing list