Boost C++ Libraries: Ticket #10657: Win32 first time call to GetTimeZoneInformation crashes in launched coroutines https://svn.boost.org/trac10/ticket/10657 <p> When an application's first call <a class="missing wiki">GetTimeZoneInformation</a> is from a launched coroutine, an unhandled exception is generated. A workaround is to call <a class="missing wiki">GetTimeZoneInformation</a> at least once before launching any coroutines. This sample program compiles under Visual Studio and crashes: </p> <pre class="wiki">#define _WIN32_WINNT 0x6000 #include &lt;boost/asio/io_service.hpp&gt; #include &lt;boost/asio/spawn.hpp&gt; #include &lt;functional&gt; #include &lt;Windows.h&gt; TIME_ZONE_INFORMATION tzi; void die(boost::asio::yield_context yield) { GetTimeZoneInformation(&amp;tzi); } int main() { // Uncommenting the following line eliminates the crash //GetTimeZoneInformation(&amp;tzi); boost::asio::io_service ios; boost::asio::spawn (ios, std::bind (&amp;die, std::placeholders::_1)); ios.run(); } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10657 Trac 1.4.3 vinnie.falco@… Wed, 15 Oct 2014 02:38:13 GMT <link>https://svn.boost.org/trac10/ticket/10657#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10657#comment:1</guid> <description> <p> Stack: </p> <pre class="wiki">KernelBase.dll!TlsGetValue KernelBase.dll!BaseGetProcessDllPath KernelBase.dll!LoadLibraryExW KernelBase.dll!ConvertTimeZoneMuiString KernelBase.dll!ConvertTimeZoneMuiStrings KernelBase.dll!GetTimeZoneInformation sandbox.exe!die(boost::asio::basic_yield_context&lt;boost::asio::detail::wrapped_handler&lt;boost::asio::io_service::strand,void (__cdecl*)(void),boost::asio::detail::is_continuation_if_running&gt; &gt; yield) Line 12 C++ sandbox.exe!boost::asio::detail::coro_entry_point&lt;boost::asio::detail::wrapped_handler&lt;boost::asio::io_service::strand,void (__cdecl*)(void),boost::asio::detail::is_continuation_if_running&gt;,std::_Bind&lt;1,void,void (__cdecl*const)(boost::asio::basic_yield_context&lt;boost::asio::detail::wrapped_handler&lt;boost::asio::io_service::strand,void (__cdecl*)(void),boost::asio::detail::is_continuation_if_running&gt; &gt;),std::_Ph&lt;1&gt; &amp; __ptr64&gt; &gt;::operator()(boost::coroutines::pull_coroutine&lt;void&gt; &amp; ca) Line 257 C++ sandbox.exe!boost::coroutines::detail::push_coroutine_object&lt;boost::coroutines::pull_coroutine&lt;void&gt;,void,boost::asio::detail::coro_entry_point&lt;boost::asio::detail::wrapped_handler&lt;boost::asio::io_service::strand,void (__cdecl*)(void),boost::asio::detail::is_continuation_if_running&gt;,std::_Bind&lt;1,void,void (__cdecl*const)(boost::asio::basic_yield_context&lt;boost::asio::detail::wrapped_handler&lt;boost::asio::io_service::strand,void (__cdecl*)(void),boost::asio::detail::is_continuation_if_running&gt; &gt;),std::_Ph&lt;1&gt; &amp; __ptr64&gt; &gt; &amp; __ptr64,boost::coroutines::basic_standard_stack_allocator&lt;boost::coroutines::stack_traits&gt; &gt;::run() Line 306 C++ [External Code] </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 15 Oct 2014 04:22:20 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10657#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10657#comment:2</guid> <description> <p> I believe <a class="missing wiki">GetTimeZoneInformation</a> calls <a class="missing wiki">LoadLibraryEx</a> which calls <a class="missing wiki">BaseGetProcessDllPath</a> which dies in <a class="missing wiki">TlsGetValue</a>. <a class="missing wiki">TlsGetValue</a> can die if the TLS slot is uninitialized. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>olli</dc:creator> <pubDate>Sat, 25 Apr 2015 15:25:13 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/10657#comment:3 https://svn.boost.org/trac10/ticket/10657#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> Unfortunately I got the info from Microsoft that some parts of the TIB have to be swapped during context switch too - but Microsoft refused to share which parts. </p> Ticket