Opened 10 years ago

Closed 10 years ago

#8336 closed Bugs (fixed)

fusion sequence io manipulators are thread un-safe

Reported by: jeffrey.flinn@… Owned by: Joel de Guzman
Milestone: To Be Determined Component: fusion
Version: Boost 1.54.0 Severity: Problem
Keywords: fusion, sequence, io, manipulator, thread Cc:

Description

boost::detail::stream_data::attach uses a std::vector to store instances of data associated with the tuple_open, tuple_close, tuple_delimiter io manipulators. When streaming unrelated fusion sets to unrelated ostringstreams from different threads fails MSVC's debug iterator checks leading to an assert.

Additionally the stored data items once constructed remain in memory until program exit.

The attached patch removes the static vector instance, allowing the stream to properly manage the manipulator data lifetime by using std::ios_base::register_callback.

Attachments (3)

manip.hpp.patch (2.7 KB ) - added by jeffrey.flinn@… 10 years ago.
patch with thread safety fix
manip.hpp.2.patch (4.5 KB ) - added by jeffrey.flinn@… 10 years ago.
updated patch replacing local static initialization with C++03 class static initialization
io.cpp.patch (1.1 KB ) - added by Jeffrey.Flinn@… 10 years ago.
added test for overwriting tuple_xxx io manipulater, using strings as values, fix compile warning

Download all attachments as: .zip

Change History (5)

by jeffrey.flinn@…, 10 years ago

Attachment: manip.hpp.patch added

patch with thread safety fix

by jeffrey.flinn@…, 10 years ago

Attachment: manip.hpp.2.patch added

updated patch replacing local static initialization with C++03 class static initialization

comment:1 by anonymous, 10 years ago

Replaced local static initialization with C++03 class static initialization similar to the boost units lib io.hpp implementation.

by Jeffrey.Flinn@…, 10 years ago

Attachment: io.cpp.patch added

added test for overwriting tuple_xxx io manipulater, using strings as values, fix compile warning

comment:2 by Joel de Guzman, 10 years ago

Resolution: fixed
Status: newclosed

(In [84002]) Fixes #8336

Note: See TracTickets for help on using tickets.