Boost C++ Libraries: Ticket #9119: memory errors and eventual segfault when using Log https://svn.boost.org/trac10/ticket/9119 <p> Hello, </p> <p> I'm using the the Log component of Boost 1.54 compiled from source and I get many memory errors and segfault while invoking the function logging::add_file_log. To make sure it was not my code, I went to the Boost installation and ran valgrind on some of the Log examples that invoke that function and it happens also there. The minimalistic example tutorial_file.cpp reveals the issue (though there may be more issues with Log). I get many memory errors in Mac OS X and Ubuntu, in Mac OS X it doesn't crash the application but I get a segfault in Ubuntu. </p> <p> I'm attaching the valgrind output on Ubuntu 12.04 with kernel version "Linux HPC 3.5.0-40-generic <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/62" title="#62: Bugs: Rational sum not optimal for overflows (closed: Rejected)">#62</a>~precise1-Ubuntu SMP Fri Aug 23 17:38:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux". </p> <p> Best regards, Giovanni </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9119 Trac 1.4.3 Giovanni Azua <bravegag@…> Mon, 16 Sep 2013 13:56:57 GMT attachment set https://svn.boost.org/trac10/ticket/9119 https://svn.boost.org/trac10/ticket/9119 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">valgrind.log</span> </li> </ul> <p> valgrind output </p> Ticket Giovanni Azua <bravegag@…> Mon, 16 Sep 2013 13:59:20 GMT <link>https://svn.boost.org/trac10/ticket/9119#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9119#comment:1</guid> <description> <p> The attached file was generated with the command: </p> <pre class="wiki">valgrind --show-reachable=yes --dsymutil=yes --track-origins=yes ./tutorial_file 2&gt; valgrind.log </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Mon, 16 Sep 2013 14:10:04 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9119#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9119#comment:2</guid> <description> <p> I believe, this is caused by <a class="assigned ticket" href="https://svn.boost.org/trac10/ticket/8642" title="#8642: Bugs: Global locale prevents from using Boost.Filesystem in global ... (assigned)">#8642</a>. </p> <p> To workaround try removing all sinks prior to returning from main(). </p> </description> <category>Ticket</category> </item> <item> <author>Giovanni Azua <bravegag@…></author> <pubDate>Mon, 16 Sep 2013 14:13:05 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9119#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9119#comment:3</guid> <description> <p> Thank you for your suggestion, however this happens during logging initialization and not prior to returning from main. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Mon, 16 Sep 2013 14:20:09 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9119#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9119#comment:4</guid> <description> <p> The valgrind log you attached points to an invalid memory access during the global destructors execution. Do you have a log that shows a different crash? </p> </description> <category>Ticket</category> </item> <item> <author>Giovanni Azua <bravegag@…></author> <pubDate>Mon, 16 Sep 2013 16:02:38 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/9119 https://svn.boost.org/trac10/ticket/9119 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">valgrind2.log</span> </li> </ul> Ticket Giovanni Azua <bravegag@…> Mon, 16 Sep 2013 16:04:24 GMT <link>https://svn.boost.org/trac10/ticket/9119#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9119#comment:5</guid> <description> <p> OK attached valgrind2.log that shows my application startup crashing due to this same issue. The same code does not segfault in Mac OS X but the errors are revealed in valgrind also in Mac OS X. </p> </description> <category>Ticket</category> </item> <item> <author>Giovanni Azua <bravegag@…></author> <pubDate>Mon, 16 Sep 2013 16:07:01 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9119#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9119#comment:6</guid> <description> <p> Please note that the last crash is triggered while invoking logging::add_file_log </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Mon, 16 Sep 2013 17:38:56 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9119#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9119#comment:7</guid> <description> <p> It looks like now the crash happens during global constructors stage, but still in the code related to the global locale initialization in Boost.Filesystem. I haven't seen this one before, but I don't see how it can be fixed on Boost.Log side. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Thu, 03 Oct 2013 22:12:11 GMT</pubDate> <title>keywords, owner, component changed https://svn.boost.org/trac10/ticket/9119#comment:8 https://svn.boost.org/trac10/ticket/9119#comment:8 <ul> <li><strong>keywords</strong> filesystem locale added </li> <li><strong>owner</strong> changed from <span class="trac-author">Andrey Semashev</span> to <span class="trac-author">Beman Dawes</span> </li> <li><strong>component</strong> <span class="trac-field-old">log</span> → <span class="trac-field-new">filesystem</span> </li> </ul> <p> It seems the problem is isolated in Boost.Filesystem (more precisely, its global locale initialization). I'm reassigning the ticket to Boost.Filesystem maintainer, I hope he can suggest a solution. </p> Ticket Andrey Semashev Thu, 03 Oct 2013 22:13:32 GMT keywords changed; cc set https://svn.boost.org/trac10/ticket/9119#comment:9 https://svn.boost.org/trac10/ticket/9119#comment:9 <ul> <li><strong>cc</strong> <span class="trac-author">Andrey.Semashev@…</span> added </li> <li><strong>keywords</strong> log,add_file_log,filesystem,locale → log add_file_log filesystem locale </li> </ul> Ticket