Summary: | ASTERISK-12804: [patch] MALLOC_DEBUG causes crash in chan_h323 | ||
Reporter: | pj (pj) | Labels: | |
Date Opened: | 2008-10-01 14:32:09 | Date Closed: | 2009-03-10 23:33:30 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Core/General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) 20081001__bug13593.diff.txt ( 1) valgrind.zip ( 2) valgrind2.zip | |
Description: | When asterisk is compiled also with MALLOC_DEBUG, asterisk crashes after sip-h323 call is answered. Other debug options like DONT_OPTIMIZE DEBUG_THREADS DEBUG_CHANNEL_LOCKS doesn't have impact to crash. Another my asterisk system (SVN-trunk-r141949) is working fine with chan_h323, even if MALLOC_DEBUG is enabled. ****** ADDITIONAL INFORMATION ****** gdb probably doesn't have usefull info: Program terminated with signal 6, Aborted. #0 0xffffe410 in __kernel_vsyscall () (gdb) bt #0 0xffffe410 in __kernel_vsyscall () #1 0xb73fa5d5 in raise () from /lib/i686/libc.so.6 #2 0xb73fc021 in abort () from /lib/i686/libc.so.6 #3 0xb743235c in free () from /lib/i686/libc.so.6 #4 0x00000024 in ?? () ASTERISK-1 0xb6c0d9dc in ?? () ASTERISK-2 0x00000400 in ?? () here is output from cli when crash happened: [root@localhost asterisk145552]# *** glibc detected *** asterisk: munmap_chunk(): invalid pointer: 0x08281d28 *** ======= Backtrace: ========= /lib/i686/libc.so.6(cfree+0x1bb)[0xb743dc1b] /usr/lib/asterisk/modules/chan_h323.so[0xb6e4e061] /usr/lib/asterisk/modules/chan_h323.so[0xb6e4e14a] /usr/src/h323/openh323/lib/libh323_linux_x86_r.so.1.18.0(_ZNK22H323RealTimeCapability13CreateChannelER14H323ConnectionN11H323Channel10DirectionsEjPK34H245_H2250LogicalChannelParameters+0x22)[0xb7ca71ea] /usr/src/h323/openh323/lib/libh323_linux_x86_r.so.1.18.0(_ZN21H245NegLogicalChannel15OpenWhileLockedERK14H323Capabilityjj+0x19c)[0xb7c9cedc] /usr/src/h323/openh323/lib/libh323_linux_x86_r.so.1.18.0(_ZN21H245NegLogicalChannel4OpenERK14H323Capabilityjj+0x37)[0xb7c9b6cb] /usr/src/h323/openh323/lib/libh323_linux_x86_r.so.1.18.0(_ZN22H245NegLogicalChannels4OpenERK14H323Capabilityjj+0x96)[0xb7c9eee4] | ||
Comments: | By: Tilghman Lesher (tilghman) 2008-10-01 15:11:36 Actually, this backtrace tells me that you're getting memory corruption. Could you please follow the instructions in doc/valgrind.txt? By: pj (pj) 2008-10-01 15:52:10 uploading valgrind.zip... weird is, that if I run asterisk from valgrind it does NOT crash valgrind --log-file=valgrind.txt /usr/sbin/asterisk -vvvvc 2>malloc_debug.txt but if I run simply by /usr/sbin/asterisk -vvvvc it always crash By: Tilghman Lesher (tilghman) 2008-10-01 16:55:14 Patch uploaded. By: pj (pj) 2008-10-02 06:38:35 SVN-trunk-r145487 + 20081001__bug13593.diff.txt sad to say, no change, it still crash immediatelly, after chan_h323 is answered (test call to playback and echo), when compiled with MALLOC DEBUG. uploading valgrind2.zip, but you will see nothing new there. notice again, when run from valgrind and make test call, it does NOT crash. second notice: I have pwlib and openh323 compiled with "make opt" By: pj (pj) 2009-01-23 14:02:58.000-0600 Hi, I'm original reporter of this issue, but because of lack development in chan_h323, I abadoned h323 from my asterisk. Sorry, I can't give any further feedback about chan_h323, because currently I haven't any suitable device to test h323. Thank you for understanding. By: Jeff Peeler (jpeeler) 2009-01-25 00:03:07.000-0600 Thanks for the update. I've actually reproduced it so I shouldn't need any additional feedback. I won't consider this too high of a priority though since you're no longer interested and the problem only occurs with MALLOC_DEBUG turned on. By: Digium Subversion (svnbot) 2009-03-10 22:25:05 Repository: asterisk Revision: 181133 U branches/1.4/apps/app_meetme.c U branches/1.4/channels/chan_iax2.c U branches/1.4/channels/chan_sip.c U branches/1.4/channels/h323/ast_h323.cxx U branches/1.4/include/asterisk/astmm.h U branches/1.4/include/asterisk/threadstorage.h U branches/1.4/include/asterisk/utils.h U branches/1.4/pbx/pbx_ael.c U branches/1.4/pbx/pbx_config.c U branches/1.4/res/res_features.c ------------------------------------------------------------------------ r181133 | jpeeler | 2009-03-10 22:25:05 -0500 (Tue, 10 Mar 2009) | 13 lines Fix malloc debug macros to work properly with h323. The main problem here was that cstdlib was undefining free thereby causing the proper debug macros to not be used. ast_h323.cxx has been changed to call ast_free instead to avoid the issue. Because using the ast prefix calls are a better choice, ast_free_ptr is the new wrapper for free to pass to functions. Also, a little bit of clean up was done to avoid the debug macros intentionally being redefined. (closes issue ASTERISK-12804) Reported by: pj ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=181133 By: Digium Subversion (svnbot) 2009-03-10 22:30:19 Repository: asterisk Revision: 181134 _U trunk/ ------------------------------------------------------------------------ r181134 | jpeeler | 2009-03-10 22:30:19 -0500 (Tue, 10 Mar 2009) | 18 lines Blocked revisions 181133 via svnmerge ........ r181133 | jpeeler | 2009-03-10 22:25:04 -0500 (Tue, 10 Mar 2009) | 13 lines Fix malloc debug macros to work properly with h323. The main problem here was that cstdlib was undefining free thereby causing the proper debug macros to not be used. ast_h323.cxx has been changed to call ast_free instead to avoid the issue. Because using the ast prefix calls are a better choice, ast_free_ptr is the new wrapper for free to pass to functions. Also, a little bit of clean up was done to avoid the debug macros intentionally being redefined. (closes issue ASTERISK-12804) Reported by: pj ........ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=181134 By: Digium Subversion (svnbot) 2009-03-10 23:06:45 Repository: asterisk Revision: 181135 U trunk/channels/chan_sip.c U trunk/channels/h323/ast_h323.cxx U trunk/include/asterisk/astmm.h U trunk/include/asterisk/utils.h U trunk/main/features.c U trunk/pbx/pbx_config.c U trunk/utils/Makefile U trunk/utils/extconf.c ------------------------------------------------------------------------ r181135 | jpeeler | 2009-03-10 23:06:45 -0500 (Tue, 10 Mar 2009) | 20 lines Fix malloc debug macros to work properly with h323. The main problem here was that cstdlib was undefining free thereby causing the proper debug macros to not be used. ast_h323.cxx has been changed to call ast_free instead to avoid the issue. A few other issues were addressed: - There were a few instances of functions improperly passing ast_free instead of ast_free_ptr. - Some clean up was done to avoid the debug macros intentionally being redefined. (copied below from Kevin's commit, appreciate the help) - disable astmm.h from doing anything when STANDALONE is defined, which is used by the tools in the utils/ directory that use parts of Asterisk header files in hackish ways; also ensure that utils/extconf.c and utils/conf2ael.c are compiled with STANDALONE defined. (closes issue ASTERISK-12804) Reported by: pj ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=181135 By: Digium Subversion (svnbot) 2009-03-10 23:17:27 Repository: asterisk Revision: 181137 _U branches/1.6.0/ U branches/1.6.0/channels/chan_sip.c U branches/1.6.0/channels/h323/ast_h323.cxx U branches/1.6.0/include/asterisk/astmm.h U branches/1.6.0/include/asterisk/utils.h U branches/1.6.0/utils/Makefile U branches/1.6.0/utils/extconf.c ------------------------------------------------------------------------ r181137 | jpeeler | 2009-03-10 23:17:27 -0500 (Tue, 10 Mar 2009) | 26 lines Merged revisions 181135 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ........ r181135 | jpeeler | 2009-03-10 23:06:44 -0500 (Tue, 10 Mar 2009) | 20 lines Fix malloc debug macros to work properly with h323. The main problem here was that cstdlib was undefining free thereby causing the proper debug macros to not be used. ast_h323.cxx has been changed to call ast_free instead to avoid the issue. A few other issues were addressed: - There were a few instances of functions improperly passing ast_free instead of ast_free_ptr. - Some clean up was done to avoid the debug macros intentionally being redefined. (copied below from Kevin's commit, appreciate the help) - disable astmm.h from doing anything when STANDALONE is defined, which is used by the tools in the utils/ directory that use parts of Asterisk header files in hackish ways; also ensure that utils/extconf.c and utils/conf2ael.c are compiled with STANDALONE defined. (closes issue ASTERISK-12804) Reported by: pj ........ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=181137 By: Digium Subversion (svnbot) 2009-03-10 23:33:30 Repository: asterisk Revision: 181199 _U branches/1.6.1/ U branches/1.6.1/channels/chan_sip.c U branches/1.6.1/channels/h323/ast_h323.cxx U branches/1.6.1/include/asterisk/astmm.h U branches/1.6.1/include/asterisk/utils.h U branches/1.6.1/main/features.c U branches/1.6.1/pbx/pbx_config.c U branches/1.6.1/utils/Makefile U branches/1.6.1/utils/extconf.c ------------------------------------------------------------------------ r181199 | jpeeler | 2009-03-10 23:33:29 -0500 (Tue, 10 Mar 2009) | 26 lines Merged revisions 181135 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ........ r181135 | jpeeler | 2009-03-10 23:06:44 -0500 (Tue, 10 Mar 2009) | 20 lines Fix malloc debug macros to work properly with h323. The main problem here was that cstdlib was undefining free thereby causing the proper debug macros to not be used. ast_h323.cxx has been changed to call ast_free instead to avoid the issue. A few other issues were addressed: - There were a few instances of functions improperly passing ast_free instead of ast_free_ptr. - Some clean up was done to avoid the debug macros intentionally being redefined. (copied below from Kevin's commit, appreciate the help) - disable astmm.h from doing anything when STANDALONE is defined, which is used by the tools in the utils/ directory that use parts of Asterisk header files in hackish ways; also ensure that utils/extconf.c and utils/conf2ael.c are compiled with STANDALONE defined. (closes issue ASTERISK-12804) Reported by: pj ........ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=181199 |