<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][14919] </title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=14919">14919</a></dd>
<dt>Author</dt> <dd>anthm</dd>
<dt>Date</dt> <dd>2009-09-18 10:55:10 -0500 (Fri, 18 Sep 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>farewell crash protection</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunkconfautoload_configsswitchconfxml">freeswitch/trunk/conf/autoload_configs/switch.conf.xml</a></li>
<li><a href="#freeswitchtrunksrcincludeswitch_typesh">freeswitch/trunk/src/include/switch_types.h</a></li>
<li><a href="#freeswitchtrunksrcswitch_corec">freeswitch/trunk/src/switch_core.c</a></li>
<li><a href="#freeswitchtrunksrcswitch_core_state_machinec">freeswitch/trunk/src/switch_core_state_machine.c</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunkconfautoload_configsswitchconfxml"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/conf/autoload_configs/switch.conf.xml (14918 => 14919)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/conf/autoload_configs/switch.conf.xml        2009-09-18 15:42:54 UTC (rev 14918)
+++ freeswitch/trunk/conf/autoload_configs/switch.conf.xml        2009-09-18 15:55:10 UTC (rev 14919)
</span><span class="lines">@@ -24,8 +24,6 @@
</span><span class="cx">     &lt;param name=&quot;sessions-per-second&quot; value=&quot;30&quot;/&gt;
</span><span class="cx">     &lt;!-- Default Global Log Level - value is one of debug,info,notice,warning,err,crit,alert --&gt;
</span><span class="cx">     &lt;param name=&quot;loglevel&quot; value=&quot;debug&quot;/&gt;
</span><del>-    &lt;!--Try to catch any crashes that can be recoverable (in the context of a call)--&gt;
-    &lt;param name=&quot;crash-protection&quot; value=&quot;false&quot;/&gt;
</del><span class="cx">         &lt;!-- The min_dtmf_duration specifies the minimum DTMF duration to use on 
</span><span class="cx">              outgoing events. Events shorter than this will be increased in duration
</span><span class="cx">                  to match min_dtmf_duration. You cannot configure a dtmf duration on a 
</span></span></pre></div>
<a id="freeswitchtrunksrcincludeswitch_typesh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/include/switch_types.h (14918 => 14919)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/include/switch_types.h        2009-09-18 15:42:54 UTC (rev 14918)
+++ freeswitch/trunk/src/include/switch_types.h        2009-09-18 15:55:10 UTC (rev 14919)
</span><span class="lines">@@ -231,11 +231,10 @@
</span><span class="cx">         SCF_USE_SQL = (1 &lt;&lt; 0),
</span><span class="cx">         SCF_NO_NEW_SESSIONS = (1 &lt;&lt; 1),
</span><span class="cx">         SCF_SHUTTING_DOWN = (1 &lt;&lt; 2),
</span><del>-        SCF_CRASH_PROT = (1 &lt;&lt; 3),
-        SCF_VG = (1 &lt;&lt; 4),
-        SCF_RESTART = (1 &lt;&lt; 5),
-        SCF_SHUTDOWN_REQUESTED = (1 &lt;&lt; 6),
-        SCF_USE_AUTO_NAT = (1 &lt;&lt; 7)
</del><ins>+        SCF_VG = (1 &lt;&lt; 3),
+        SCF_RESTART = (1 &lt;&lt; 4),
+        SCF_SHUTDOWN_REQUESTED = (1 &lt;&lt; 5),
+        SCF_USE_AUTO_NAT = (1 &lt;&lt; 6)
</ins><span class="cx"> } switch_core_flag_enum_t;
</span><span class="cx"> typedef uint32_t switch_core_flag_t;
</span><span class="cx"> 
</span></span></pre></div>
<a id="freeswitchtrunksrcswitch_corec"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/switch_core.c (14918 => 14919)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/switch_core.c        2009-09-18 15:42:54 UTC (rev 14918)
+++ freeswitch/trunk/src/switch_core.c        2009-09-18 15:55:10 UTC (rev 14919)
</span><span class="lines">@@ -1379,11 +1379,7 @@
</span><span class="cx">                                 const char *var = switch_xml_attr_soft(param, &quot;name&quot;);
</span><span class="cx">                                 const char *val = switch_xml_attr_soft(param, &quot;value&quot;);
</span><span class="cx"> 
</span><del>-                                if (!strcasecmp(var, &quot;crash-protection&quot;)) {
-                                        if (switch_true(val)) {
-                                                switch_set_flag((&amp;runtime), SCF_CRASH_PROT);
-                                        }
-                                } else if (!strcasecmp(var, &quot;loglevel&quot;)) {
</del><ins>+                                if (!strcasecmp(var, &quot;loglevel&quot;)) {
</ins><span class="cx">                                         int level;
</span><span class="cx">                                         if (*val &gt; 47 &amp;&amp; *val &lt; 58) {
</span><span class="cx">                                                 level = atoi(val);
</span><span class="lines">@@ -1507,8 +1503,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,
</span><del>-                                          &quot;\nFreeSWITCH Version %s Started.\nCrash Protection [%s]\nMax Sessions[%u]\nSession Rate[%d]\nSQL [%s]\n&quot;, SWITCH_VERSION_FULL,
-                                          switch_test_flag((&amp;runtime), SCF_CRASH_PROT) ? &quot;Enabled&quot; : &quot;Disabled&quot;,
</del><ins>+                                          &quot;\nFreeSWITCH Version %s Started.\nMax Sessions[%u]\nSession Rate[%d]\nSQL [%s]\n&quot;, SWITCH_VERSION_FULL,
</ins><span class="cx">                                           switch_core_session_limit(0),
</span><span class="cx">                                           switch_core_sessions_per_second(0), switch_test_flag((&amp;runtime), SCF_USE_SQL) ? &quot;Enabled&quot; : &quot;Disabled&quot;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="freeswitchtrunksrcswitch_core_state_machinec"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/switch_core_state_machine.c (14918 => 14919)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/switch_core_state_machine.c        2009-09-18 15:42:54 UTC (rev 14918)
+++ freeswitch/trunk/src/switch_core_state_machine.c        2009-09-18 15:55:10 UTC (rev 14919)
</span><span class="lines">@@ -212,75 +212,9 @@
</span><span class="cx">         switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, &quot;%s Standard HIBERNATE\n&quot;, switch_channel_get_name(session-&gt;channel));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#include &lt;sqlite3.h&gt;
-#include &quot;../../../libs/sqlite/src/hash.h&quot;
-
-//static switch_hash_t *stack_table = NULL;
-static Hash stack_table;
-static switch_mutex_t *stack_mutex = NULL;
-
-#if defined (__GNUC__) &amp;&amp; defined (LINUX) &amp;&amp; defined (HAVE_EXECINFO_H)
-#include &lt;execinfo.h&gt;
-#include &lt;stdio.h&gt;
-#include &lt;stdlib.h&gt;
-#define STACK_LEN 10
-
-/* Obtain a backtrace and print it to stdout. */
-static void print_trace(void)
-{
-        void *array[STACK_LEN];
-        size_t size;
-        char **strings;
-        size_t i;
-
-        size = backtrace(array, STACK_LEN);
-        strings = backtrace_symbols(array, size);
-
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, &quot;Obtained %zd stack frames.\n&quot;, size);
-
-        for (i = 0; i &lt; size; i++) {
-                switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CRIT, &quot;%s\n&quot;, strings[i]);
-        }
-
-        free(strings);
-}
-#else
-static void print_trace(void)
-{
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, &quot;Trace not available =(\n&quot;);
-}
-#endif
-
-static void handle_fatality(int sig)
-{
-        switch_thread_id_t thread_id;
-        jmp_buf *env;
-
-        if (!sig) return;
-
-        thread_id = switch_thread_self();
-        switch_mutex_lock(stack_mutex);
-        env = (jmp_buf *) sqlite3HashFind(&amp;stack_table, &amp;thread_id, sizeof(thread_id));
-        switch_mutex_unlock(stack_mutex);
-
-        if (thread_id &amp;&amp; env) {
-                print_trace();
-                longjmp(*env, sig);
-        } else {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, &quot;Caught signal %d for unmapped thread!&quot;, sig);
-                abort();
-        }
-}
-
</del><span class="cx"> void switch_core_state_machine_init(switch_memory_pool_t *pool)
</span><span class="cx"> {
</span><del>-
-        if (switch_test_flag((&amp;runtime), SCF_CRASH_PROT)) {
-                switch_mutex_init(&amp;stack_mutex, SWITCH_MUTEX_NESTED, pool);
-                switch_mutex_lock(stack_mutex);
-                sqlite3HashInit(&amp;stack_table, SQLITE_HASH_BINARY, 0);
-                switch_mutex_unlock(stack_mutex);
-        }
</del><ins>+        return;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #define STATE_MACRO(__STATE, __STATE_STR)                                                do {        \
</span><span class="lines">@@ -329,35 +263,9 @@
</span><span class="cx">         const switch_endpoint_interface_t *endpoint_interface;
</span><span class="cx">         const switch_state_handler_table_t *driver_state_handler = NULL;
</span><span class="cx">         const switch_state_handler_table_t *application_state_handler = NULL;
</span><del>-        switch_thread_id_t thread_id;
-        jmp_buf env;
-        int sig, silly = 0;
</del><ins>+        int silly = 0;
</ins><span class="cx">         uint32_t new_loops = 60000;
</span><span class="cx"> 
</span><del>-        if (switch_test_flag((&amp;runtime), SCF_CRASH_PROT)) {
-                thread_id = switch_thread_self();
-                signal(SIGSEGV, handle_fatality);
-                signal(SIGFPE, handle_fatality);
-#ifndef WIN32
-                signal(SIGBUS, handle_fatality);
-#endif
-
-                if ((sig = setjmp(env)) != 0) {
-                        switch_event_t *event;
-
-                        if (switch_event_create(&amp;event, SWITCH_EVENT_SESSION_CRASH) == SWITCH_STATUS_SUCCESS) {
-                                switch_channel_event_set_data(session-&gt;channel, event);
-                                switch_event_fire(&amp;event);
-                        }
-                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, &quot;Thread has crashed for channel %s\n&quot;, switch_channel_get_name(session-&gt;channel));
-                        switch_channel_hangup(session-&gt;channel, SWITCH_CAUSE_CRASH);
-                } else {
-                        switch_mutex_lock(stack_mutex);
-                        sqlite3HashInsert(&amp;stack_table, &amp;thread_id, sizeof(thread_id), (void *) &amp;env);
-                        switch_mutex_unlock(stack_mutex);
-                }
-        }
-
</del><span class="cx">         /*
</span><span class="cx">            Life of the channel. you have channel and pool in your session
</span><span class="cx">            everywhere you go you use the session to malloc with
</span><span class="lines">@@ -474,10 +382,6 @@
</span><span class="cx">   done:
</span><span class="cx">         switch_mutex_unlock(session-&gt;mutex);
</span><span class="cx"> 
</span><del>-        if (switch_test_flag((&amp;runtime), SCF_CRASH_PROT)) {
-                sqlite3HashInsert(&amp;stack_table, &amp;thread_id, sizeof(thread_id), NULL);
-                //apr_hash_set(stack_table, &amp;thread_id, sizeof(thread_id), NULL);
-        }
</del><span class="cx">         session-&gt;thread_running = 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>