[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
Tue Jul 31 16:50:39 CDT 2007
A NOTE has been added to this issue.
======================================================================
http://bugs.digium.com/view.php?id=10347
======================================================================
Reported By: explidous
Assigned To:
======================================================================
Project: Asterisk
Issue ID: 10347
Category: CDR/cdr_csv
Reproducibility: always
Severity: crash
Priority: normal
Status: new
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:
======================================================================
Date Submitted: 07-31-2007 16:13 CDT
Last Modified: 07-31-2007 16:50 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 - 07-31-07 16:50
----------------------------------------------------------------------
I guess we would need to put the locking in (un)load_module also
Issue History
Date Modified Username Field Change
======================================================================
07-31-07 16:50 qwell Note Added: 0068170
======================================================================
More information about the asterisk-bugs
mailing list