Boost C++ Libraries: Ticket #5257: Concurrent posix_time streaming crashes https://svn.boost.org/trac10/ticket/5257 <p> The attached program crashes under MinGW-32 gcc-4.4, (but works under VC8). </p> <p> It does concurrent streaming of posix_time::ptime values to independent std::ostringstream objects. </p> <p> Mutexing the ostringstream from construction to destruction keeps it from crashing, but that shouldn't have to be done for independent streams. Mutexing just the ptime insertions makes it run longer, but it still crashes. And removing concurrency (i.e., running just one thread) allows it to run. </p> <p> Could this be related to Tickets <a class="ext-link" href="https://svn.boost.org/trac/boost/ticket/3961"><span class="icon">​</span>3961</a>, <a class="ext-link" href="https://svn.boost.org/trac/boost/ticket/3369"><span class="icon">​</span>3369</a> or <a class="ext-link" href="https://svn.boost.org/trac/boost/ticket/4846"><span class="icon">​</span>4846</a>. </p> <p> Build command-lines: </p> <hr /> <p> MinGW:<br /> g++ -DBOOST_THREAD_USE_LIB DTConcur.cpp -IC:\Software\Open\lib\boost_1_45_0\ -DWIN32 -D_WINDOWS -LC:\Software\Open\lib\boost_1_45_0\mgw44\lib -mthreads -g -frtti -fexceptions -mthreads -Wall -lstdc++ -lmingw32 -o DTConcur -lboost_thread-mgw44-mt-s-1_45 </p> <hr /> <p> VC8:<br /> cl DTConcur.cpp /IC:\Software\Open\lib\boost_1_45_0\ /MT /D BOOST_THREAD_USE_LIB /GR /EHsc /D "WIN32" /D "_WINDOWS" /FeDTConcur.exe /link /LIBPATH:C:\Software\Open\lib\boost_1_45_0\msvc8\lib </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5257 Trac 1.4.3 Jim Bell <jim@…> Thu, 03 Mar 2011 15:30:01 GMT attachment set https://svn.boost.org/trac10/ticket/5257 https://svn.boost.org/trac10/ticket/5257 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">DTConcur.cpp</span> </li> </ul> Ticket Jim Bell <jim@…> Tue, 15 Mar 2011 19:49:46 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/5257#comment:1 https://svn.boost.org/trac10/ticket/5257#comment:1 <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> This is most likely caused by <a class="ext-link" href="https://sourceforge.net/tracker/?func=detail&amp;aid=2843440&amp;group_id=2435&amp;atid=102435"><span class="icon">​</span>MinGW Issue 2843440</a>, stemming from a thread safety problem with msvcrt.dll and iostream imbue. </p> <p> This is still an issue on Windows XP SP3 (as of March, 2011). </p> <p> Work-around (empirically): mutex all streaming over the entire life of the stream object, including constructor and destructor. </p> Ticket