Boost C++ Libraries: Ticket #13528: Boost Test 1.67 crashes when the --report_sink command-line parameter is used https://svn.boost.org/trac10/ticket/13528 <p> Environment: Visual Studio 15.6, 64-bit build of Boost. </p> <p> Scenario: a Boost.Test executable crashes with an access violation when run with the -e command-line argument. </p> <p> Cause: Boost.Test has two global singletons, a framework::state instance inside s_frk_state() and a results_reporter_impl instance inside s_rr_impl(). Their relative destruction order is undefined, in my case the results_reporter_impl instance is destroyed before the framework::state instance. The following sequence of events then takes place: </p> <p> 1) framework::state::~state destroys the m_report_sink member, leading to the stream_holder::~stream_holder call. </p> <p> 2) stream_holder::~stream_holder destroys m_cleaner, which calls stream_holder::callback_cleaner::~callback_cleaner. </p> <p> 3) stream_holder::callback_cleaner::~callback_cleaner calls the m_cleaner_callback callback, which was passed from framework::init. </p> <p> 4) The callback calls results_reporter::set_stream. </p> <p> 5) results_reporter::set_stream accesses the results_reporter_impl singleton instance, which has been already destroyed, and the program crashes. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13528 Trac 1.4.3 Raffi Enficiaud Tue, 24 Apr 2018 20:27:33 GMT owner, status changed https://svn.boost.org/trac10/ticket/13528#comment:1 https://svn.boost.org/trac10/ticket/13528#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Gennadiy Rozental</span> to <span class="trac-author">Raffi Enficiaud</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket Raffi Enficiaud Tue, 19 Jun 2018 20:11:55 GMT <link>https://svn.boost.org/trac10/ticket/13528#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13528#comment:2</guid> <description> <p> Hi, </p> <p> I am looking at this now, and there is something I do not get in your report (thank you for the level of details BTW). </p> <p> During the <code>stream_holder::callback_cleaner::~callback_cleaner</code>, there is a test about the callback: </p> <pre class="wiki"> ~callback_cleaner() { if( m_cleaner_callback ) m_cleaner_callback(); } </pre><p> and <code>m_cleaner_callback</code> should have been resetted to an empty function during the call to <code>shutdown_loggers_and_reports()</code> (in the <code>framework::shutdown</code> call). </p> <p> So I am not sure to understand why this is happening for you. Are you still able to reproduce? In that case, are you entering the call to the callback? </p> </description> <category>Ticket</category> </item> <item> <author>Igor Akhmetov <igor.akhmetov@…></author> <pubDate>Wed, 20 Jun 2018 09:35:21 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/13528#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13528#comment:3</guid> <description> <p> Sorry, missed a detail - I was also using the <code>--list_content</code> command-line argument. When either <code>--list_labels</code> or <code>--list_content</code> are used, <code>unit_test_main</code> exits prematurely and does not call <code>framework::shutdown</code>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Raffi Enficiaud</dc:creator> <pubDate>Wed, 20 Jun 2018 12:09:46 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/13528#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13528#comment:4</guid> <description> <p> Go it, thanks! I am able to reproduce and easily fix this. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Raffi Enficiaud</dc:creator> <pubDate>Thu, 21 Jun 2018 05:11:13 GMT</pubDate> <title>milestone changed https://svn.boost.org/trac10/ticket/13528#comment:5 https://svn.boost.org/trac10/ticket/13528#comment:5 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.68.0</span> </li> </ul> Ticket Raffi Enficiaud Wed, 01 Aug 2018 17:06:39 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/13528#comment:6 https://svn.boost.org/trac10/ticket/13528#comment:6 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket