[asterisk-bugs] [Asterisk 0014384]: Background leaves files open indefinately

Asterisk Bug Tracker noreply at bugs.digium.com
Wed Feb 4 09:31:26 CST 2009


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=14384 
====================================================================== 
Reported By:                fiddur
Assigned To:                putnopvut
====================================================================== 
Project:                    Asterisk
Issue ID:                   14384
Category:                   Core/PBX
Reproducibility:            always
Severity:                   block
Priority:                   normal
Status:                     closed
Asterisk Version:           SVN 
Regression:                 No 
SVN Branch (only for SVN checkouts, not tarball releases): 1.6.0 
SVN Revision (number only!): 172742 
Request Review:              
Resolution:                 fixed
Fixed in Version:           
====================================================================== 
Date Submitted:             2009-02-02 04:57 CST
Last Modified:              2009-02-04 09:31 CST
====================================================================== 
Summary:                    Background leaves files open indefinately
Description: 
After a Background(mysound) the sound file stays open, according to lsof.

This leads after a while to a total crippling of asterisk since it can't
open any socket, getting "Too many open files" or "Can't create alert
pipe!".
====================================================================== 

---------------------------------------------------------------------- 
 (0099427) svnbot (reporter) - 2009-02-04 09:31
 http://bugs.digium.com/view.php?id=14384#c99427 
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 173356

_U  branches/1.6.1/
U   branches/1.6.1/main/file.c

------------------------------------------------------------------------
r173356 | mmichelson | 2009-02-04 09:31:26 -0600 (Wed, 04 Feb 2009) | 38
lines

Merged revisions 173354 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r173354 | mmichelson | 2009-02-04 09:30:12 -0600 (Wed, 04 Feb 2009) | 30
lines

Fix a problem where file playback would cause fds to remain open forever

The problem came from the fact that a frame read from a format interpreter
was not freed. Adding a call to ast_frfree fixed this. The explanation for
why this caused the problem is a bit complex, but here goes:

There was a problem in all versions of Asterisk where the embedded frame
of a filestream structure was referenced after the filestream was freed.
This
was fixed by adding reference counting to the filestream structure. The
refcount
would increase every time that a filestream's frame pointer was pointing
to an
actual frame of data. When the frame was freed, the refcount would
decrease. Once
the refcount reached 0, the filestream was freed, and as part of the
operation,
the open files were closed as well.

Thus it becomes more clear why a missing ast_frfree would cause a
reference leak
and cause the files to not be closed. You may ask then if there was a
frame leak
before this patch. The answer to that is actually no! The filestream code
was
"smart" enough to know that since the frame we received came from a format
interpreter,
the frame had no malloced data and thus didn't need to be freed. Now,
however, there
is cleanup that needs to be done when we finish with the frame, so we do
need to
call ast_frfree on the frame to be sure that the refcount for the
filestream is
decremented appropriately.

(closes issue http://bugs.digium.com/view.php?id=14384)
Reported by: fiddur
Patches:
      14384.patch uploaded by putnopvut (license 60)
Tested by: fiddur, putnopvut


........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=173356 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-02-04 09:31 svnbot         Checkin                                      
2009-02-04 09:31 svnbot         Note Added: 0099427                          
======================================================================




More information about the asterisk-bugs mailing list