Opened 12 years ago

Closed 12 years ago

#5257 closed Bugs (wontfix)

Concurrent posix_time streaming crashes

Reported by: Jim Bell <jim@…> Owned by: az_sw_dude
Milestone: Boost 1.47.0 Component: date_time
Version: Boost 1.45.0 Severity: Problem
Keywords: posix_time ptime ostream imbue MinGW-32 crash Cc: jim@…

Description

The attached program crashes under MinGW-32 gcc-4.4, (but works under VC8).

It does concurrent streaming of posix_time::ptime values to independent std::ostringstream objects.

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.

Could this be related to Tickets 3961, 3369 or 4846.

Build command-lines:


MinGW:
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


VC8:
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

Attachments (1)

DTConcur.cpp (1.9 KB ) - added by Jim Bell <jim@…> 12 years ago.

Download all attachments as: .zip

Change History (2)

by Jim Bell <jim@…>, 12 years ago

Attachment: DTConcur.cpp added

comment:1 by Jim Bell <jim@…>, 12 years ago

Resolution: wontfix
Status: newclosed

This is most likely caused by MinGW Issue 2843440, stemming from a thread safety problem with msvcrt.dll and iostream imbue.

This is still an issue on Windows XP SP3 (as of March, 2011).

Work-around (empirically): mutex all streaming over the entire life of the stream object, including constructor and destructor.

Note: See TracTickets for help on using tickets.