| Summary: | ASTERISK-09721: Race condition on cdr_pgsql config reload | ||
| Reporter: | Prashant Jois (prashant_jois) | Labels: | |
| Date Opened: | 2007-06-20 14:49:43 | Date Closed: | 2007-06-20 17:32:46 | 
| Priority: | Minor | Regression? | No | 
| Status: | Closed/Complete | Components: | CDR/cdr_pgsql | 
| Versions: | Frequency of Occurrence | ||
| Related Issues: | |||
| Environment: | Attachments: | ( 0) cdr_pgsql.diff | |
| Description: | I noticed that in cdr_pgsql.c the reload() function calls my_unload_module() followed by my_load_module().  However, neither of these functions acquires the lock "pgsql_lock" before releasing the global database connection handle.  This spells disaster if a thread is running through pgsql_log() when a reload takes place. I propose adding a lock/unlock in reload(). ****** ADDITIONAL INFORMATION ****** Submitted is a patch (cdr_pgsql.diff) for the proposed modification on cdr_pgsql.c for Asterisk 1.4.5. | ||
| Comments: | By: Jason Parker (jparker) 2007-06-20 15:02:14 You're going to need to have a disclaimer on file before we can review/use this patch (the same goes for your other bug report). Please see http://asterisk.org/developers/bug-guidelines under the heading "The License Agreement (disclaimer)" By: Prashant Jois (prashant_jois) 2007-06-20 17:20:27 I don't have easy access to a fax machine, so this will probably not get done. Anyway, you don't need to use my patch... it's not exactly revolutionary, a lock and an unlock on the mutex, 2 lines of code. Same goes for the other bug, 3 lines of code. By: Jason Parker (jparker) 2007-06-20 17:32:46 Fixed in svn branches 1.4 and trunk in revisions 70554 and 70555. | ||