Boost C++ Libraries: Ticket #5409: Creation of the named mutex may take even 1.5 minute https://svn.boost.org/trac10/ticket/5409 <p> Dears, </p> <p> We faced the problem that creation of the named mutex may take up to 1.5 minutes(!). We had been able to debug which function call is really using that amount of time. </p> <p> In the file: </p> <p> boost\interprocess\detail\tmp_dir_helpers.hpp </p> <p> in the function: </p> <p> inline void tmp_folder(std::string &amp;tmp_name) { </p> <blockquote> <p> get_tmp_base_dir(tmp_name); #ifdef BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME tmp_name += "/"; get_bootstamp(tmp_name, true); #endif </p> </blockquote> <p> } </p> <p> call to get_bootstamp(tmp_name, true); is waiting VERY long time. We saw that this function is using some WMI to get timestamp. </p> <p> We found that there are other methods to obtain boot time. Maybe that will be helpful and those methods are not using expensive calls to WMI: </p> <p> <a class="ext-link" href="http://cpp.canbal.com/view.php?sessionid=qAo6EkHmKh9INoDkejiDum9LBQNvGWi2yoDfERxglB4%3D"><span class="icon">​</span>http://cpp.canbal.com/view.php?sessionid=qAo6EkHmKh9INoDkejiDum9LBQNvGWi2yoDfERxglB4%3D</a> </p> <p> <a class="ext-link" href="http://stackoverflow.com/questions/5411140/retrieving-boot-time-using-gettickcount64"><span class="icon">​</span>http://stackoverflow.com/questions/5411140/retrieving-boot-time-using-gettickcount64</a> </p> <p> As that was a show stopper for us, we commented out parts of that function, so our function looks like: </p> <p> inline void tmp_folder(std::string &amp;tmp_name) { </p> <blockquote> <p> get_tmp_base_dir(tmp_name); <em>#ifdef BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME </em>tmp_name += "/"; <em>get_bootstamp(tmp_name, true); </em>#endif </p> </blockquote> <p> } </p> <p> It is not nice, but it works (for us) :-). </p> <p> Best regards, Seweryn. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5409 Trac 1.4.3 anonymous Fri, 01 Apr 2011 13:21:23 GMT attachment set https://svn.boost.org/trac10/ticket/5409 https://svn.boost.org/trac10/ticket/5409 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">tmp_dir_helpers_hpp.patch</span> </li> </ul> Ticket Ion Gaztañaga Fri, 01 Apr 2011 16:24:47 GMT <link>https://svn.boost.org/trac10/ticket/5409#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5409#comment:1</guid> <description> <p> Those methods don't help much to get a real timestamp that won't change with clock changes, hibernations, etc. </p> <p> Finding a method to obtain a bootstamp (using kernel internals or WMI) in windows so that shared memory, queues, etc are erased when rebooting a machine have brought more problems than solutions. </p> <p> I will disable bootstamp in new versions. POSIX allows shared memory to survive a reboot and that's what we'll have in Windows until someone finds a better method. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Fri, 01 Apr 2011 17:09:44 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/5409#comment:2 https://svn.boost.org/trac10/ticket/5409#comment:2 <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">fixed</span> </li> </ul> <p> WMI is provoking a lot of problems for Boost Interprocess users. I've decided to remove bootstamp use in windows to obtain kernel persistence in Windows. This means that windows shared memory/queues will survive to reboots, but this behaviour is allowed by POSIX. Using bootstamps to detect reboots is doing more harm than good. </p> <p> WMI is removed in Boost 1.47 </p> Ticket