<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Feb 15, 2009, at 9:49 AM, Ron Avriel wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Hi,<br><br>Under Windows, FreeSWITCH consistently crashes with all default install setting after issuing the ‘shutdown’<span class="Apple-converted-space"> </span><br>command from console immediately after startup, without a single call handled.<span class="Apple-converted-space"> </span><br>Note that on my servers, this only happens in ‘Release’ version, not in ‘Debug’.<br><br>The problem is due to “problematic” Windows thread handling.<br>I noticed that all FS threads are ‘detachable’ and not ‘joinable’. When an application with active detached threads terminates, a race condition can lead to the application crash, as shown in the sample application<span class="Apple-converted-space"> </span><br>at<span class="Apple-converted-space"> </span><a href="http://pastebin.freeswitch.org/7225">http://pastebin.freeswitch.org/7225</a><span class="Apple-converted-space"> </span>.<span class="Apple-converted-space"> </span><br><br>This is exactly what causes FS to crash as a result of the mod_event_socket detached runtime thread.<br><br>A temporary workaround is to change in switch_loadable_module_exec() the call to<span class="Apple-converted-space"> </span><br>switch_yield(1000000) with switch_thread_exit(thread, 0).<br><br>In my case it solved the crash, but theoretically it does not always solve the problem, because there is no<span class="Apple-converted-space"> </span><br>guarantee that it will get called before the main thread reaches its termination code.<br><br>I think the only safe solution is to use ‘joinable’ threads. Is there a good reason they’re not used?<span class="Apple-converted-space"> </span><br><br>Note – this problem was reported to jira about a month ago<span class="Apple-converted-space"> </span><a href="http://jira.freeswitch.org/browse/MODEVENT-37%20">http://jira.freeswitch.org/browse/MODEVENT-37<span class="Apple-converted-space"> </span></a>but it seems it was ignored.<br><br></div></div></span></blockquote><div><br></div>The issue has not been ignored, it just has not been resolved yet. Please put these details on that bug, I'll take a look.</div><div><br></div><div>Mike</div><div><br></div></body></html>