[asterisk-commits] kmoore: branch 1.8 r371690 - /branches/1.8/main/utils.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 27 08:43:29 CDT 2012


Author: kmoore
Date: Mon Aug 27 08:43:23 2012
New Revision: 371690

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=371690
Log:
Implement workaround for BETTER_BACKTRACES crash

When compiling with BETTER_BACKTRACES enabled, Asterisk will sometimes
crash when "core show locks" is run. This happens regularly in the
testsuite since several tests run "core show locks" to help with
debugging. This seems to be a fault with libraries on certain operating
systems (notably CentOS 6.2/6.3) running on virtual machines and
utilizing gcc 4.4.6.

(closes issue ASTERISK-20090)

Modified:
    branches/1.8/main/utils.c

Modified: branches/1.8/main/utils.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/utils.c?view=diff&rev=371690&r1=371689&r2=371690
==============================================================================
--- branches/1.8/main/utils.c (original)
+++ branches/1.8/main/utils.c Mon Aug 27 08:43:23 2012
@@ -770,16 +770,20 @@
 static void append_backtrace_information(struct ast_str **str, struct ast_bt *bt)
 {
 	char **symbols;
+	int num_frames;
 
 	if (!bt) {
 		ast_str_append(str, 0, "\tNo backtrace to print\n");
 		return;
 	}
 
-	if ((symbols = ast_bt_get_symbols(bt->addresses, bt->num_frames))) {
+	/* store frame count locally to avoid the memory corruption that
+	 * sometimes happens on virtualized CentOS 6.x systems */
+	num_frames = bt->num_frames;
+	if ((symbols = ast_bt_get_symbols(bt->addresses, num_frames))) {
 		int frame_iterator;
 		
-		for (frame_iterator = 0; frame_iterator < bt->num_frames; ++frame_iterator) {
+		for (frame_iterator = 0; frame_iterator < num_frames; ++frame_iterator) {
 			ast_str_append(str, 0, "\t%s\n", symbols[frame_iterator]);
 		}
 




More information about the asterisk-commits mailing list