<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt">Hi,<br><br>Under Windows, FreeSWITCH consistently crashes with all default install setting after issuing the ‘shutdown’ <br>command from console immediately after startup, without a single call handled. <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 <br>at <a href="http://pastebin.freeswitch.org/7225">http://pastebin.freeswitch.org/7225</a> . <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 <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 <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? <br><br>Note – this problem was reported to jira about a month ago <a href="http://jira.freeswitch.org/browse/MODEVENT-37%20">http://jira.freeswitch.org/browse/MODEVENT-37 </a>but it seems it was ignored.<br><br>Thanks,<br>Ron<br><br></div><br>



      </body></html>