[asterisk-bugs] [Asterisk 0015474]: [patch] Race condition in cdr_syslog.c (SVN Revision 205561)

Asterisk Bug Tracker noreply at bugs.digium.com
Mon Dec 20 08:05:23 UTC 2010


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=15474 
====================================================================== 
Reported By:                praise
Assigned To:                seanbright
====================================================================== 
Project:                    Asterisk
Issue ID:                   15474
Category:                   CDR/NewFeature
Reproducibility:            sometimes
Severity:                   minor
Priority:                   normal
Status:                     assigned
Asterisk Version:           SVN 
JIRA:                        
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!): 205561 
Request Review:              
====================================================================== 
Date Submitted:             2009-07-09 06:28 CDT
Last Modified:              2010-12-20 02:05 CST
====================================================================== 
Summary:                    [patch] Race condition in cdr_syslog.c (SVN Revision
205561)
Description: 
There is a race condition in these lines of code:

openlog(sink->ident, LOG_CONS, sink->facility);
syslog(sink->priority, "%s", ast_str_buffer(str));
closelog();

openlog interferes with all syslog calls in the process. Since asterisk
is multithreaded, some other syslog message may be sent with syslog
ident/facility, or some other call to openlog might interfere with this
module's
syslog call.
This is not going to happen very often, but nevertheless it is an issue.

I have resolved here piping to a different process which routes all
messages
to syslog with correct values,but implementation of a global syslog
manager could be a more elegant solution.

====================================================================== 

---------------------------------------------------------------------- 
 (0129779) tilghman (manager) - 2010-12-20 02:05
 https://issues.asterisk.org/view.php?id=15474#c129779 
---------------------------------------------------------------------- 
This problem extends even into our core logger, where it is possible to
specify multiple "syslog" statements in logger.conf, and a conflict will
result.  Patch uploaded to fix this problem, which also suggests an API for
fixing the cdr_syslog problem, as well. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-12-20 02:05 tilghman       Note Added: 0129779                          
======================================================================




More information about the asterisk-bugs mailing list