[Home]

Summary:ASTERISK-14441: [patch] Race condition in cdr_syslog.c (SVN Revision 205561)
Reporter:Tazio Ceri (praise)Labels:patch
Date Opened:2009-07-09 06:28:42Date Closed:2020-01-11 07:44:53.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:CDR/NewFeature
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20101220__issue15474__1.4.diff.txt
( 1) 20111027__issue15474__1.8.diff.txt
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.
Comments:By: Tilghman Lesher (tilghman) 2010-12-20 02:05:23.000-0600

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.

By: Sean Bright (seanbright) 2011-10-27 11:09:08.300-0500

Very nice.   I've updated the patch to 1.8 and attached if someone wants to test with a newer version.

By: Sean Bright (seanbright) 2020-01-11 07:44:53.948-0600

{{cdr_syslog}} was deprecated in Jan 2018 and there are no plans to update or fix this module.