aboutsummaryrefslogtreecommitdiffstats
path: root/cdr/cdr_odbc.c
AgeCommit message (Collapse)AuthorFilesLines
2008-10-16This patch is relevant to:murf1-3/+12
ABE-1628 and RYM-150398 and AST-103 in internal Digium bug trackers. These fixes address a really subtle memory corruption problem that would happen in machines heavily loaded in production environments. The corruption would always take the form of the STMT object getting nulled out and one of the unixODBC calls would crash trying to access statement->connection. It isn't fully proven yet, but the server has now been running 2.5 days without appreciable memory growth, or any gain of %cpu, and no crashes. Whether this is the problem or not on that server, these fixes are still warranted. As it turns out, **I** introduced these errors unwittingly, when I corrected another crash earlier. I had formed the build_query routine, and failed to remove mutex_unlock calls in 3 places in the transplanted code. These unlocks would only happen in error situations, but unlocking the mutex early set the code up for a catastrophic failure, it appears. It would happen only once every 100K-200K or more calls, under heavy load... but that is enough. If another crash occurs, with the same MO, I'll come back and remove my confession from the log, and we'll keep searching, but the fact that we have Asterisk dying from an asynchronous wiping of the STMT object, only on some connection error, and that the server has lived for 2.5 days on this code without a crash, sure make it look like this was the problem! Also, in several points, Statement handles are set to NULL after SQLFreeHandle. This was mainly for insurance, to guarantee a crash. As it turns out, the code does not appear to be attempting to use these freed pointers. Asterisk owes a debt of gratitude to Federico Alves and Frediano Ziglio for their untiring efforts in finding this bug, among others. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@150056 f38db490-d61c-443f-a65b-d21fe96a405b
2008-09-23In at least one machine, we noted that the timestrmurf1-8/+7
was not getting set in the STMT; it was coming out, usually, as binary garbage to an mssql server. These changes fixed the problem. The only thing I can venture forth as a guess, is that the pointer is being stored in the interface, not a copy of the string. Because we ripped the build process into a subroutine, the timestr became a temp. stack variable, and between the time the STMT got built and the time it was executed on the server, the string being pointed to was damaged. At any rate, even if this theory is false, and some mechanism was at fault, this fix worked reliably where it didn't before. Why this bug didn't bite last week, I have no idea. This change basically defines the timestr buffer in the calling function, extending the life of the buffer to cover both the STMT's building and processing to the server. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@143964 f38db490-d61c-443f-a65b-d21fe96a405b
2008-09-19This fix comes from a debugging session on a test box that has been getting ↵murf1-10/+15
hung channels when the mssqlserver bounces. All the connections then become invalid, and must be reconnected. The cdr_odbc backend had code to do it, but depended on re-establishing the connection, but re-using the STMT that had been built. By trial and error, we determined that the STMT could not be re-used after the connection was re-established. and must be rebuilt. These changes accomplish this. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@143674 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-18To prevent 92138749238754 more reports of "I have unixodbc installed, butrussell1-0/+1
still can't build *_odbc.so!", check for ltdl directly, instead of just listing it as another library to include in the unixodbc check in the configure script. This also makes ltdl show up as a dependency in menuselect so people know what to go install. (related to issue #9989, patch by me) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@69702 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-14use ast_localtime() in every place localtime_r() was being usedkpfleming1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@69392 f38db490-d61c-443f-a65b-d21fe96a405b
2007-03-29Merged revisions 59301 via svnmerge from tilghman1-4/+0
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r59301 | tilghman | 2007-03-29 11:04:46 -0500 (Thu, 29 Mar 2007) | 3 lines Issue 9415 - No point to getting a diagnostic field if we aren't doing anything with the information. (Plus, it tends to crash the Postgres ODBC driver.) ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@59302 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-23Merged revisions 45927 via svnmerge from file1-1/+2
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r45927 | file | 2006-10-22 20:25:28 -0400 (Sun, 22 Oct 2006) | 2 lines Don't leak memory mmmk? ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@45928 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-20Constify the result of a config retrieval function, to avoid mutilation ↵tilghman1-1/+1
(issue 7983). git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43364 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-31everything that loads a config that needs a config file to runmogorman1-0/+1
now reports AST_MODULE_LOAD_DECLINE when loading if config file is not there, also fixed an error in res_config_pgsql where it had a non static function when it should. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@41633 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-21merge new_loader_completion branch, including (at least):kpfleming1-16/+9
- restructured build tree and makefiles to eliminate recursion problems - support for embedded modules - support for static builds - simpler cross-compilation support - simpler module/loader interface (no exported symbols) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@40722 f38db490-d61c-443f-a65b-d21fe96a405b
2006-06-07simplify autoconfig include mechanism (make tholo happy he can use lint ↵kpfleming1-4/+4
again :-) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@32846 f38db490-d61c-443f-a65b-d21fe96a405b
2006-04-24Thanks to the fine work of Russell Bryant and Dancho Lazarov, we now have ↵kpfleming1-0/+4
autoconf and menuselect tools for Asterisk! git-svn-id: http://svn.digium.com/svn/asterisk/trunk@22267 f38db490-d61c-443f-a65b-d21fe96a405b
2006-04-19Merged revisions 21597 via svnmerge from tilghman1-20/+18
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r21597 | tilghman | 2006-04-19 13:43:17 -0500 (Wed, 19 Apr 2006) | 2 lines Bug 6553 - plug memory leaks when ODBC connection is down ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@21600 f38db490-d61c-443f-a65b-d21fe96a405b
2006-04-14Compatibility fixes for loader changestilghman1-16/+7
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@20075 f38db490-d61c-443f-a65b-d21fe96a405b
2006-04-08since the module API is changing, it's a good time to const-ify the ↵kpfleming1-2/+2
description() and key() return values git-svn-id: http://svn.digium.com/svn/asterisk/trunk@18552 f38db490-d61c-443f-a65b-d21fe96a405b
2006-03-01Merged revisions 11503 via svnmerge from tilghman1-5/+5
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r11503 | tilghman | 2006-03-01 11:41:52 -0600 (Wed, 01 Mar 2006) | 2 lines Bug 6615 - Fix 64bit conversion errors by using a long int ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@11504 f38db490-d61c-443f-a65b-d21fe96a405b
2005-11-29git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7221 ↵kpfleming1-0/+0
f38db490-d61c-443f-a65b-d21fe96a405b
2005-11-06issue #5605russell1-0/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6979 f38db490-d61c-443f-a65b-d21fe96a405b
2005-10-26more doxygenification (issue #5513)russell1-2/+7
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6852 f38db490-d61c-443f-a65b-d21fe96a405b
2005-10-22fix reload problem - unload_module was not setting connected to 0 (issue #5498)russell1-0/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6843 f38db490-d61c-443f-a65b-d21fe96a405b
2005-09-14update MANY more files with proper copyright/license info (thanks Ian!)kpfleming1-4/+15
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6596 f38db490-d61c-443f-a65b-d21fe96a405b
2005-09-08more Cygwin portability (issue #4678)kpfleming1-0/+7
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6548 f38db490-d61c-443f-a65b-d21fe96a405b
2005-07-14clarify commentrussell1-1/+2
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6128 f38db490-d61c-443f-a65b-d21fe96a405b
2005-07-11remove complex malloc-avoidance (bug #4601)kpfleming1-55/+25
remove resetting of variables during unload that will only be freed or set to known values on reload git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6085 f38db490-d61c-443f-a65b-d21fe96a405b
2005-06-06more file version tagskpfleming1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5866 f38db490-d61c-443f-a65b-d21fe96a405b
2005-06-06another round of version tag updates, along with 'show version files' ↵kpfleming1-8/+11
pattern filtering git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5865 f38db490-d61c-443f-a65b-d21fe96a405b
2005-06-06let ODBC username/password default to the ones in odbc.ini (bug #4470)kpfleming1-8/+7
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5854 f38db490-d61c-443f-a65b-d21fe96a405b
2005-04-21use double-quotes instead of angle-brackets for non-system include files ↵kpfleming1-7/+7
(bug #4058) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5490 f38db490-d61c-443f-a65b-d21fe96a405b
2005-02-04Optionally store CDR's in GM time (bug #3500, with mods)markster1-7/+25
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4962 f38db490-d61c-443f-a65b-d21fe96a405b
2005-01-25Merge config updates (bug #3406)markster1-2/+2
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4889 f38db490-d61c-443f-a65b-d21fe96a405b
2005-01-15ODBC CDR fixes for bizarre error conditions and small performance ↵markster1-36/+36
improvement (bug #3340) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4799 f38db490-d61c-443f-a65b-d21fe96a405b
2005-01-11Fix types for character (bug #3255, take 3)markster1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4765 f38db490-d61c-443f-a65b-d21fe96a405b
2005-01-11Make ODBC storage as int configurable to be string or int (bug #3255)markster1-1/+9
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4763 f38db490-d61c-443f-a65b-d21fe96a405b
2005-01-05Make cdr_odbc store disposition as string not integer (thus matching ↵markster1-1/+1
documentation in doc/cdr.txt) (bug #3255) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4687 f38db490-d61c-443f-a65b-d21fe96a405b
2004-12-10make table configurable for cdr_odbc (bug #2755)russell1-7/+37
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4416 f38db490-d61c-443f-a65b-d21fe96a405b
2004-11-25fix mem leak (bug #2940)russell1-0/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4333 f38db490-d61c-443f-a65b-d21fe96a405b
2004-10-05Formatting fix and use ast_true in cdr_odbc.c (bug 2569) Thanks bkw_citats1-134/+71
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3911 f38db490-d61c-443f-a65b-d21fe96a405b
2004-07-14Merge remaining audit patch (save dlfcn.c)markster1-7/+10
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3436 f38db490-d61c-443f-a65b-d21fe96a405b
2004-07-08Merge bkw_'s ODBC patchmarkster1-5/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3395 f38db490-d61c-443f-a65b-d21fe96a405b
2004-06-09Merge FreeBSD locking fixes (bug #1411)markster1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3176 f38db490-d61c-443f-a65b-d21fe96a405b
2004-05-21Fix FreeTDS/MSSQL from bkwjeremy1-32/+32
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3031 f38db490-d61c-443f-a65b-d21fe96a405b
2004-01-22ODBC fix for PPC (bug #895)markster1-4/+4
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@2056 f38db490-d61c-443f-a65b-d21fe96a405b
2004-01-13change warning into notice.jeremy1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1992 f38db490-d61c-443f-a65b-d21fe96a405b
2004-01-11Log cdr user data, if enabledjeremy1-2/+3
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1931 f38db490-d61c-443f-a65b-d21fe96a405b
2004-01-04prevent deadlock if no config filejeremy1-3/+4
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1889 f38db490-d61c-443f-a65b-d21fe96a405b
2003-12-24fix a small memory leak, from brianjeremy1-1/+11
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1880 f38db490-d61c-443f-a65b-d21fe96a405b
2003-12-24Brian's ODBC patchesmarkster1-115/+88
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1878 f38db490-d61c-443f-a65b-d21fe96a405b
2003-12-09stop seg when no loguniqueid is set in config file. From bkwjeremy1-1/+2
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1845 f38db490-d61c-443f-a65b-d21fe96a405b
2003-12-07fix a minor typo from brianjeremy1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1837 f38db490-d61c-443f-a65b-d21fe96a405b
2003-12-07More updates from Brianmarkster1-11/+65
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1836 f38db490-d61c-443f-a65b-d21fe96a405b