<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="chsdate"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        text-align:justify;
        text-justify:inter-ideograph;
        font-size:10.5pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:9.0pt;
        font-family:SimSun;}
/* Page Definitions */
@page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 126.65pt 72.0pt 126.65pt;
        layout-grid:15.6pt;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang=ZH-CN link=blue vlink=purple style='text-justify-trim:punctuation'>
<div class=Section1 style='layout-grid:15.6pt'>
<p class=MsoPlainText><font size=1 color=blue face=宋体><span
lang=EN-US style='font-size:9.0pt;color:blue'>I debug this asterisk process
with gdb + asterisk + pid <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 color=blue face=宋体><span
lang=EN-US style='font-size:9.0pt;color:blue'>I found it will not break in for(){</span></font><font
color=blue face="Courier New"><span lang=EN-US style='font-family:"Courier New";
color:blue'>…</span></font><font color=blue><span lang=EN-US
style='color:blue'>.} in asterisk.c ,look</span></font><font color=blue
face="Courier New"><span lang=EN-US style='font-family:"Courier New";
color:blue'>…</span></font><font color=blue><span lang=EN-US
style='color:blue'><o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 color=blue face=宋体><span
lang=EN-US><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'> </span></font><span
lang=DA>for (;;) {<o:p></o:p></span></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=DA
style='font-size:9.0pt'> buf
= (char *)el_gets(el, &num);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=DA
style='font-size:9.0pt'> </span><font
color=red><span lang=EN-US style='color:red'>if (buf) {<o:p></o:p></span></font></font></p>
<p class=MsoPlainText><font size=1 color=red face=宋体><span
lang=EN-US style='font-size:9.0pt;color:red'> if
(buf[strlen(buf)-1] == '\n')<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 color=red face=宋体><span
lang=EN-US style='font-size:9.0pt;color:red'> </span></font><font
color=red><span lang=DA style='color:red'>buf[strlen(buf)-1] = '\0';<o:p></o:p></span></font></p>
<p class=MsoPlainText><font color=red><span lang=DA style='color:red'><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=1 color=red face=宋体><span
lang=DA style='font-size:9.0pt;color:red'> </span><span
lang=EN-US>consolehandler((char *)buf);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 color=red face=宋体><span
lang=EN-US style='font-size:9.0pt;color:red'> }</span></font><span
lang=EN-US> else if (ast_opt_remote && (write(STDOUT_FILENO,
"\nUse EXIT or QUIT to exit the asterisk console\n",<o:p></o:p></span></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>
strlen("\nUse EXIT or QUIT to exit the asterisk console\n")) < 0))
{<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'> /*
Whoa, stdout disappeared from under us... Make /dev/null's */<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'> int
fd;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'> fd
= open("/dev/null", O_RDWR);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'> if
(fd > -1) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'> dup2(fd,
STDOUT_FILENO);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'> dup2(fd,
STDIN_FILENO);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'> }
else<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'> ast_log(LOG_WARNING,
"Failed to open /dev/null to recover from dead console. Bad things will
happen!\n");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'> break;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'> }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'> }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>-----</span>邮件原件<span
lang=EN-US>-----<br>
</span>发件人<span lang=EN-US>:
asterisk-dev-bounces@lists.digium.com [mailto:asterisk-dev-bounces@lists.digium.com]
</span>代表 <span lang=EN-US>Tzafrir Cohen<br>
</span>发送时间<span lang=EN-US>: <st1:chsdate
IsROCDate="False" IsLunarDate="False" Day="19" Month="3" Year="2008" w:st="on">2008<span
lang=EN-US><span lang=EN-US>年3</span></span><span lang=EN-US><span
lang=EN-US>月19</span></span><span lang=EN-US><span lang=EN-US>日</span></span></st1:chsdate>
19:14<br>
</span>收件人<span lang=EN-US>: asterisk-dev@lists.digium.com<br>
</span>主题<span lang=EN-US>: Re: [asterisk-dev] the cpu be 99% for
asterisk-<st1:chsdate IsROCDate="False" IsLunarDate="False" Day="30" Month="12"
Year="1899" w:st="on">1.4.0</st1:chsdate></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>On Wed, Mar 19, 2008 at 02:33:33PM +0800, scott.lv
wrote:<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>> Step<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>> 1. login in
centos by ssh SecureCRT 5.1<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>> 2. launch
asterisk by command asterisk -cvvvvv<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>> 3. close ssh
SecureCRT 5.1 window<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>> 4. login in
centos from another ssh SecureCRT 5.1<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>> 5. look up
asterisk status in top command <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>> 6. asterisk
cpu is 99%............................<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>You gave practically no details about your issue. Do
you see any<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>interesting message in the logs?
/var/log/asterisk/messages ?<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>Also note that many bugs have been fixed since <st1:chsdate
IsROCDate="False" IsLunarDate="False" Day="30" Month="12" Year="1899" w:st="on">1.4.0</st1:chsdate>
. Trying a newer<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>version (e.g: <st1:chsdate IsROCDate="False"
IsLunarDate="False" Day="30" Month="12" Year="1899" w:st="on">1.4.18</st1:chsdate>.1)
is another option. There's a good chance that<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>that specific issue has been fixed since.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>-- <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'> Tzafrir
Cohen<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>icq#16849755
jabber:tzafrir.cohen@xorcom.com<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>+972-50-7952406
mailto:tzafrir.cohen@xorcom.com<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>http://www.xorcom.com
iax:guest@local.xorcom.com/tzafrir<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>_______________________________________________<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>--Bandwidth and Colocation Provided by
http://www.api-digital.com--<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>asterisk-dev mailing list<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>To UNSUBSCRIBE or update options visit:<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US
style='font-size:9.0pt'>
http://lists.digium.com/mailman/listinfo/asterisk-dev<o:p></o:p></span></font></p>
</div>
</body>
</html>