[asterisk-bugs] [Asterisk 0010347]: Asterisk Crashes in cdr_csv.c during csv_log while trying to close the log file

noreply at bugs.digium.com noreply at bugs.digium.com
Thu Sep 13 14:59:12 CDT 2007


The following issue has been RESOLVED. 
====================================================================== 
http://bugs.digium.com/view.php?id=10347 
====================================================================== 
Reported By:                explidous
Assigned To:                qwell
====================================================================== 
Project:                    Asterisk
Issue ID:                   10347
Category:                   CDR/cdr_csv
Reproducibility:            always
Severity:                   crash
Priority:                   normal
Status:                     resolved
Asterisk Version:            SVN 
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!): 77826 
Disclaimer on File?:        N/A 
Request Review:              
Resolution:                 fixed
Fixed in Version:           
====================================================================== 
Date Submitted:             07-31-2007 16:13 CDT
Last Modified:              09-13-2007 14:59 CDT
====================================================================== 
Summary:                    Asterisk Crashes in cdr_csv.c during csv_log while
trying to close the log file
Description: 
Under moderately high load Asterisk crashes while trying to close the the
log file at line 296 in cdr_csv.c. It seems that two processes call this
function at the same time and try to close the file descriptor twice. This
is most likely because a lock was removed somewhere in Asterisk.

To fix this I made the module only close the file on unload and reload and
open the file on load and reload and put a lock around where it actually
writes to the file. Previously Asterisk opened the file, wrote to the file,
flushed the buffer, then closed the file. This was most likely due to the
fact that fflush() had problems in the past not properly flushing the
buffer. This has been fixes since about 2002. Now Asterisk locks, writes to
the file, unlocks, then flushes the buffer. This also makes this function
thread safe.

I have not had Asterisk crash at this point since (12 tries so far).
====================================================================== 

---------------------------------------------------------------------- 
 qwell - 09-13-07 14:59  
---------------------------------------------------------------------- 
Fixed in svn branches 1.4 and trunk in revisions 82344 and 82345. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
09-13-07 14:59  qwell          Status                   new => resolved     
09-13-07 14:59  qwell          Resolution               open => fixed       
09-13-07 14:59  qwell          Assigned To               => qwell           
09-13-07 14:59  qwell          Note Added: 0070502                          
======================================================================




More information about the asterisk-bugs mailing list