Summary: | ASTERISK-18986: Segmentation fault when cdr_mysql.conf file contains errors | ||
Reporter: | Andrzej Marchlewski (amarch) | Labels: | |
Date Opened: | 2011-12-07 17:10:00.000-0600 | Date Closed: | 2013-01-20 21:44:03.000-0600 |
Priority: | Major | Regression? | |
Status: | Closed/Complete | Components: | Addons/cdr_mysql |
Versions: | 1.8.7.1 | Frequency of Occurrence | Constant |
Related Issues: | |||
Environment: | Attachments: | ( 0) backtrace.txt ( 1) bugfix-diff | |
Description: | When I was configuring my asterisk I accidentally made a mistake in cdr_mysql.conf. After saving file and reloading configuration asterisk started crashing immediately after start. Here is bit of my cdr_mysql.conf causing crash: ;[global] hostname=localhost dbname=asteriskcdr table=cdr After I debuged this problem I found out that a config was failing to load because of parameters existing without section (section [global] get commented out). Here is my solution for this problem: =================================================================== --- cdr_mysql.c (revision 347489) +++ cdr_mysql.c (working copy) @@ -448,9 +448,14 @@ if (!cfg) { ast_log(LOG_WARNING, "Unable to load config for mysql CDR's: %s\n", config); return AST_MODULE_LOAD_SUCCESS; - } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) + } else if (cfg == CONFIG_STATUS_FILEUNCHANGED){ return AST_MODULE_LOAD_SUCCESS; + }else if (cfg == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_ERROR, "Config file %s is in an invalid format. Aborting.\n", config); + return AST_MODULE_LOAD_DECLINE; + } + if (reload) { AST_RWLIST_WRLOCK(&columns); my_unload_module(1); | ||
Comments: | By: Andrzej Marchlewski (amarch) 2011-12-07 17:16:32.727-0600 Here is bugfix svn diff of this problem By: Andrzej Marchlewski (amarch) 2011-12-08 02:30:59.392-0600 backtrace By: Leif Madsen (lmadsen) 2011-12-20 08:44:51.739-0600 I've acknowledged this issue. Thank you for taking the time to report this issue. Please note that cdr_mysql is actually deprecated in favour of cdr_odbc, and thus the support level may be reflected in that. More information about the various module support levels can be found at https://wiki.asterisk.org/wiki/display/AST/Asterisk+Module+Support+States By: Clod Patry (junky) 2012-01-27 21:06:19.354-0600 I just tested with latest trunk and that really fix his problem. Let's commit this to avoid a crash, since a lot of install are still using cdr_mysql and there's no side-effect of this patch. By: Matt Jordan (mjordan) 2013-01-20 21:43:57.210-0600 This was apparently fixed by Tilghman in r377487, on 12/9/12. As such, I'm closing this out as fixed. |