Summary: | ASTERISK-10701: "reload" command causes crash in Mac OSX Leopard 10.5 | ||
Reporter: | Jacky Keung (jackykeung) | Labels: | |
Date Opened: | 2007-11-06 17:10:39.000-0600 | Date Closed: | 2007-12-04 19:56:47.000-0600 |
Priority: | Critical | Regression? | No |
Status: | Closed/Complete | Components: | Addons/General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) bt_full.txt ( 1) bt.txt ( 2) thread_apply_all_bt.txt | |
Description: | Fresh New Mac OSX 10.5 (Leopard) installed. 1. Asterisk 1.4.13 source was downloaded and compiled from scratch. 2. Everything works great! Thank you! 3. But.. when I use command "reload", the console would exit, and the asterisk system would shutdown completely. I have to relaunch asterisk manually. (see additional information) 4. Also since Mac OSX 10.4 , using the console command "asterisk restart now" would also shutdown asterisk, and would not restart. Need to start asterisk manually again. 5. When I use "asterisk -cvvv" , I will get color syntax highlighted in the console, very nice! But when I just use "asterisk" (daemon mode), and reconnect it using "asterisk -rvvvv" then I don't see any color. This happiness to my other linux compiled asterisk systems, am I doing something wrong, or is this a bug? ****** ADDITIONAL INFORMATION ****** Asterisk 1.4.13, Copyright (C) 1999 - 2007 Digium, Inc. and others. Created by Mark Spencer <markster@digium.com> Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details. This is free software, with components licensed under the GNU General Public License version 2 and other licenses; you are welcome to redistribute it under certain conditions. Type 'core show license' for details. ========================================================================= == Parsing '/etc/asterisk/asterisk.conf': Found == Parsing '/etc/asterisk/extconfig.conf': Found Connected to Asterisk 1.4.13 currently running on Mac-Mini (pid = 11521) -- Remote UNIX connection Verbosity is at least 10 Mac-Mini*CLI> reload Disconnected from Asterisk server Executing last minute cleanups | ||
Comments: | By: Russell Bryant (russell) 2007-11-06 17:14:53.000-0600 Start asterisk with -g. Then, when it crashes, you should get a core dump. Use doc/backtrace.txt to help with getting a backtrace. By: Jacky Keung (jackykeung) 2007-11-06 17:35:25.000-0600 Feedback (In response to russell's request): 1. launch command : asterisk -vvvg -c 2. asterisk loaded without any problem 3. "reload" command used, and the following produced and asterisk crashed. ........ == Parsing '/etc/asterisk/users.conf': Found asterisk(28972,0xa038cf60) malloc: *** error for object 0x227a40: Non-aligned pointer being freed (2) *** set a breakpoint in malloc_error_break to debug Segmentation fault (core dumped) ---------- 4. However,core dump not written in /tmp root@Mac-Mini:/tmp # ls -l /tmp/core.* ls: /tmp/core.*: No such file or directory 5. Where can I find the core.dump? Thanks Russell By: tfitch (tfitch) 2007-11-17 23:19:00.000-0600 On Mac 10.4 look for core files in /cores/ But on gotcha I ran into is that the permissions on /cores/ require that the program be run as root or in the admin group. I run asterisk as its own user and group (asterisk:asterisk), so I had to futz a bit to get the core files I wanted when investigating another issue. By: Jacky Keung (jackykeung) 2007-11-18 15:51:42.000-0600 Thanks tfitch, found the core files. Using the instructions in doc/backtrace.txt : 1. gdb asterisk core.63650 -> a lot of outputs 2. bt command -> ............................................................................................... warning: Could not find object file "/asterisk/asterisk-addons-1.4.4/app_saycountpl.o" - no debug information available for "app_saycountpl.c". ....................................................................................... done #0 0x010eac52 in build_user (name=0x239590 "guest", v=0x239600, alt=0x0, temponly=0) at chan_iax2.c:9197 9197 ast_string_field_free_pools(user); (gdb) bt #0 0x010eac52 in build_user (name=0x239590 "guest", v=0x239600, alt=0x0, temponly=0) at chan_iax2.c:9197 #1 0x010f8685 in set_config (config_file=0x110d3fd "iax.conf", reload=<value temporarily unavailable, due to optimizations>) at chan_iax2.c:9788 #2 0x010f9f3f in reload_config () at chan_iax2.c:9842 #3 0x00051c95 in ast_module_reload (name=0x0) at loader.c:590 #4 0x000313e6 in handle_reload_deprecated (fd=1, argc=1, argv=0xbffff698) at cli.c:182 ASTERISK-1 0x0003519a in ast_cli_command (fd=1, s=0xc0000003 <Address 0xc0000003 out of bounds>) at cli.c:1979 ASTERISK-2 0x0001868c in main (argc=3, argv=0xbffffbf8) at asterisk.c:1395 See attachments bt.txt bt_full.txt thread_apply_all_bt.txt By: Jacky Keung (jackykeung) 2007-11-21 16:23:42.000-0600 Command reload works if and only if iax.conf is removed. I suspect the iax protocol is causing "segmentation fault" in OSX 10.5 . By: Digium Subversion (svnbot) 2007-12-04 18:32:47.000-0600 Repository: asterisk Revision: 91070 U branches/1.4/include/asterisk/lock.h ------------------------------------------------------------------------ r91070 | russell | 2007-12-04 18:32:46 -0600 (Tue, 04 Dec 2007) | 11 lines Fix some crashes in chan_iax2 that were reported as happening on Mac systems. It turns out that the problem was the Mac version of the ast_atomic_fetchadd_int() function. The Mac atomic add function returns the _new_ value, while this function is supposed to return the old value. So, the crashes happened on unreferencing objects. If the reference count was decreased to 1, ao2_ref() thought that it had been decreased to zero, and called the destructor. However, there was still an outstanding reference around. (closes issue ASTERISK-10701) (closes issue ASTERISK-10802) ------------------------------------------------------------------------ By: Digium Subversion (svnbot) 2007-12-04 19:56:47.000-0600 Repository: asterisk Revision: 91114 _U trunk/ U trunk/include/asterisk/lock.h ------------------------------------------------------------------------ r91114 | russell | 2007-12-04 19:56:46 -0600 (Tue, 04 Dec 2007) | 19 lines Merged revisions 91070 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r91070 | russell | 2007-12-04 18:35:31 -0600 (Tue, 04 Dec 2007) | 11 lines Fix some crashes in chan_iax2 that were reported as happening on Mac systems. It turns out that the problem was the Mac version of the ast_atomic_fetchadd_int() function. The Mac atomic add function returns the _new_ value, while this function is supposed to return the old value. So, the crashes happened on unreferencing objects. If the reference count was decreased to 1, ao2_ref() thought that it had been decreased to zero, and called the destructor. However, there was still an outstanding reference around. (closes issue ASTERISK-10701) (closes issue ASTERISK-10802) ........ ------------------------------------------------------------------------ |