Boost C++ Libraries: Ticket #4842: "pure virtual method called; terminate called without an active exception" on shutdown https://svn.boost.org/trac10/ticket/4842 <p> On 11/11/2010 6:32 AM, Ruediger Berlich wrote: </p> <blockquote class="citation"> <p> Hi again, </p> <p> here is an update: I have now also tested the behaviour below ("pure virtual method called; terminate called without an active exception" -&gt; related to Boost.Serialization) with Boost 1.44 and see the same problem. This does not happen with 1.43. </p> <p> Anyway, I thought it might be important to know that whatever causes this wasn't introduced with 1.45 but 1.44 (and of course I might be doing something wrong which only triggers now due to 1.44's changes in the serialization library). </p> <p> Thanks and Best Regards, Ruediger </p> <p> Ruediger Berlich wrote: </p> <blockquote class="citation"> <p> Dear all, here are a few experiences with the beta: </p> <p> Beman Dawes wrote: [...] </p> <blockquote class="citation"> <p> Please download the beta, give it a try, and report any problems you encounter. </p> </blockquote> <p> Platform: ========= Kubuntu 10.10 64 bit, g++ 4.4.5 </p> <p> Compilation: ============ Runs mostly smoothely, albeit with many warnings of the type: </p> <p> [...] libs/program_options/src/parsers.cpp:233: instantiated from here ./boost/function/function_base.hpp:321: warning: dereferencing type-punned pointer will break strict-aliasing rules ./boost/function/function_base.hpp:325: warning: dereferencing type-punned pointer will break strict-aliasing rules [...] </p> <p> This is not a new situation and has been there with many prior versions. It happens in different components. </p> <p> Compiling a complex application =============================== (The Geneva library's trunk version, close to version 0.85, see <a class="ext-link" href="http://launchpad.net/geneva"><span class="icon">​</span>http://launchpad.net/geneva</a> ; depends on probably a dozen different boost libraries) </p> <p> In order to get it to compile I hat to make a single change: I had to add "#include &lt;boost/serialization/nvp.hpp&gt;" prior to the inclusion of the date_time libraries in a single file (out of some 65 headers, some of which also include date_time), or else I would get messages of the type </p> <p> /opt/boost145/include/boost/date_time/gregorian/greg_serialize.hpp: In function ‘void boost::serialization::save(Archive&amp;, const boost::gregorian::date&amp;, unsigned int)’: /opt/boost145/include/boost/date_time/gregorian/greg_serialize.hpp:58: error: there are no arguments to ‘make_nvp’ that depend on a template parameter, so a declaration of ‘make_nvp’ must be available </p> <p> I _do_ serialize date_time objects in my application. This is new with Boost 1.45 (compared with 1.43). </p> <p> Running the application ======================= </p> <p> When running the application in serial. multithreaded or networked mode (Geneva does distributed parametric optimization, but also allows multithreaded optimization and has a serial mode for debugging), I get the error: </p> <p> [...] 1000: 4.99999977648258e-05 End of optimization reached Done ... pure virtual method called terminate called without an active exception Aborted </p> <p> "Done" is printed at the end of main(), so there are only some singletons left to clean up, one of which stems from the Boost.Serialization library, AFAIK. </p> <p> Running the application in gdb yields: </p> <p> /<strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong>/ (gdb) up #1 0x00007ffff40726b0 in abort () at abort.c:92 92 abort.c: No such file or directory. </p> <blockquote> <p> in abort.c </p> </blockquote> <p> (gdb) up #2 0x00007ffff49126bd in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/libstdc++.so.6 (gdb) up #3 0x00007ffff4910906 in ?? () from /usr/lib/libstdc++.so.6 (gdb) up #4 0x00007ffff4910933 in std::terminate() () from /usr/lib/libstdc++.so.6 (gdb) up #5 0x00007ffff491128f in __cxa_pure_virtual () from #/usr/lib/libstdc++.so.6 (gdb) up #6 0x00007ffff4fc1f16 in boost::serialization::void_cast_detail::void_caster::operator&lt;(boost::serialization::void_cast_detail::void_caster const&amp;) const () from /opt/boost145/lib/libboost_serialization.so.1.45.0 (gdb) up #7 0x00007ffff4fc282d in boost::serialization::void_cast_detail::void_caster::recursive_unregister() const </p> <blockquote> <p> () from /opt/boost145/lib/libboost_serialization.so.1.45.0 </p> </blockquote> <p> (gdb) up #8 0x00007ffff4fc2f27 in boost::serialization::void_cast_detail::void_caster_shortcut::~void_caster_shortcut() </p> <blockquote> <p> () from /opt/boost145/lib/libboost_serialization.so.1.45.0 </p> </blockquote> <p> (gdb) up #9 0x00007ffff4fc289f in boost::serialization::void_cast_detail::void_caster::recursive_unregister() const </p> <blockquote> <p> () from /opt/boost145/lib/libboost_serialization.so.1.45.0 </p> </blockquote> <p> (gdb) up #10 0x00007ffff72ad64f in boost::serialization::void_cast_detail::void_caster_primitive&lt;Gem::Geneva::GPersonalityTraits, Gem::Geneva::GObject&gt;::~void_caster_primitive (this=0x7ffff7bb7e80, </p> <blockquote> <p> __in_chrg=&lt;value optimized out&gt;) at </p> </blockquote> <p> /opt/boost145/include/boost/serialization/void_cast.hpp:198 198 recursive_unregister(); (gdb) up #11 0x00007ffff72ad7be in boost::serialization::detail::singleton_wrapper&lt;boost::serialization::void_cast_detail::void_caster_primitive&lt;Gem::Geneva::GPersonalityTraits, Gem::Geneva::GObject&gt;::~singleton_wrapper ( </p> <blockquote> <p> this=0x7ffff7bb7e80, __in_chrg=&lt;value optimized out&gt;) at /opt/boost145/include/boost/serialization/singleton.hpp:111 </p> </blockquote> <p> 111 m_is_destroyed = true; (gdb) up #12 0x00007ffff40748c0 in __cxa_finalize (d=0x7ffff7baa2d0) at cxa_finalize.c:56 56 cxa_finalize.c: No such file or directory. </p> <blockquote> <p> in cxa_finalize.c </p> </blockquote> <p> (gdb) up #13 0x00007ffff7016366 in __do_global_dtors_aux () </p> <blockquote> <p> from /home/rberlich/geneva-build/src/geneva/libgemfony-geneva.so.0.8.5rc0 </p> </blockquote> <p> (gdb) up #14 0x0000000000000000 in ?? () (gdb) up Initial frame selected; you cannot go up. /<strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong>/ </p> <p> Gem::Geneva::GPersonalityTraits is a purely virtual class, marked as such with the following code: "BOOST_SERIALIZATION_ASSUME_ABSTRACT(Gem::Geneva::GPersonalityTraits)" . GObject is the base class of all optimization-related classes. </p> <p> The exact same code compiles and runs fine with Boost 1.43, the last version I have been using excessively. I cannot really comment on Boost 1.44 , but would be happy to try if it helps. </p> <p> Note that the above problem does not seem to have any influence on the results of the program. The problems only appear at the very end of the execution, when various singletons get destroyed. </p> <p> Best Regards, Ruediger </p> </blockquote> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4842 Trac 1.4.3 jan.boehme@… Wed, 24 Nov 2010 11:32:13 GMT attachment set https://svn.boost.org/trac10/ticket/4842 https://svn.boost.org/trac10/ticket/4842 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">ticket4842.tar.bz2</span> </li> </ul> <p> sample project to reproduce the problem </p> Ticket jan.boehme@… Wed, 24 Nov 2010 11:43:53 GMT <link>https://svn.boost.org/trac10/ticket/4842#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4842#comment:1</guid> <description> <p> I attached a packed project containing a Jamroot defining two rules, one to show the crash at the mentioned location, another which works around the problem by changing the libraries link order. Of course a workaround like this isn't appropriate for real projects. This sample should help to identify the problems background. I think it's because a dll was already unloaded which brings a later delete of a belonging extended_type_info into trouble. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Thu, 25 Nov 2010 17:02:33 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4842#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4842#comment:2</guid> <description> <p> Can you verify that DLLS are unloaded in the reverse sequence of that which they are loaded? </p> <p> Are they loaded/unloaded explicitly or automatically via import libraries? </p> <p> Robert Ramey </p> </description> <category>Ticket</category> </item> <item> <author>jan,boehme@…</author> <pubDate>Thu, 25 Nov 2010 20:01:36 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4842#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4842#comment:3</guid> <description> <p> Sorry, but I have no chance to verify the DLL load/unload sequence as I can't place debug code inside this automatic mechanism. </p> <p> As you can see in the sample they are loaded automatically. </p> <p> BTW this is an only UNIX issue, which occurs since the so called "Bogdan fix" which in turn solved similar problems under Windows. </p> <p> Jan </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Mon, 29 Nov 2010 20:40:24 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4842#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4842#comment:4</guid> <description> <p> What is the "Bogdan fix"? </p> </description> <category>Ticket</category> </item> <item> <author>jan.boehme@…</author> <pubDate>Tue, 30 Nov 2010 08:19:05 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4842#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4842#comment:5</guid> <description> <p> Sorry, it contains all changes that were done regarding the following topic: </p> <p> <a class="ext-link" href="http://groups.google.com/group/boost-list/browse_thread/thread/845fc694f99b9c32?pli=1"><span class="icon">​</span>http://groups.google.com/group/boost-list/browse_thread/thread/845fc694f99b9c32?pli=1</a> </p> <p> I don't have a clue which revisions belong to it. </p> <p> Lately I asked Bogdan if the issue was finally solved and he confirmed release 1.44 brought the fix. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Tue, 14 Dec 2010 17:53:12 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4842#comment:6 https://svn.boost.org/trac10/ticket/4842#comment:6 <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">fixed</span> </li> </ul> Ticket ruediger.berlich@… Tue, 21 Dec 2010 16:17:58 GMT <link>https://svn.boost.org/trac10/ticket/4842#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4842#comment:7</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/4842#comment:6" title="Comment 6">ramey</a>:Has this fix already been committed ? I am still getting the same error with trunk release 67387. </p> </description> <category>Ticket</category> </item> <item> <author>jan.boehme@…</author> <pubDate>Wed, 12 Jan 2011 16:41:09 GMT</pubDate> <title>status changed; resolution deleted https://svn.boost.org/trac10/ticket/4842#comment:8 https://svn.boost.org/trac10/ticket/4842#comment:8 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> Could you explain why this ticket was closed. Was it classified to be a problem not related to the library itself? </p> <p> Please remember, a bug similar to this was fixed for Windows (comment 5), the Unix problem obviously still exists. </p> Ticket Robert Ramey Wed, 12 Jan 2011 17:14:11 GMT <link>https://svn.boost.org/trac10/ticket/4842#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4842#comment:9</guid> <description> <p> I couldn't reproduce it and I just assumed it was fixed as indicated in the comment. Not having any other information, I marked it as fixed. </p> <p> Robert Ramey </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Sun, 23 Jan 2011 02:40:17 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4842#comment:10 https://svn.boost.org/trac10/ticket/4842#comment:10 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket ruediger.berlich@… Tue, 25 Jan 2011 21:36:14 GMT status changed; resolution deleted https://svn.boost.org/trac10/ticket/4842#comment:11 https://svn.boost.org/trac10/ticket/4842#comment:11 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> Hi there, the problem still exists for me with the current trunk version. I have seen a similar message on the Boost.Build mailing list, which appears to relate to the same problem (although few details are given). So I assume that it is not just me. See the message "Pure virtual method called" on Boost.Build, posted on January 13, 2011 . Best Regards, Ruediger </p> Ticket ruediger.berlich@… Thu, 27 Jan 2011 14:23:24 GMT <link>https://svn.boost.org/trac10/ticket/4842#comment:12 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4842#comment:12</guid> <description> <p> Hi again, an additional piece of information: I'm observing the same problem ("pure virtual method called") with CentOS 5.5 64 bit, g++ 4.1.2 (using Boost 1.45). So I'd wager that this is a general problem on Linux systems. Best Regards, Ruediger </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Thu, 27 Jan 2011 19:03:42 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4842#comment:13 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4842#comment:13</guid> <description> <p> OK - just to recap - </p> <p> On which environments (os, compiler, shared/static library, debug vs release etc. </p> <p> So far I see linux, g++ 4.1.2 - 64 bit - no information regarding shared/static, debug/release, etc. </p> <p> Feel free to add to the above list. It would also be helpful to attempt to trim down the test case. Often times that can give information about the source of the problem. </p> <p> I am interested in addressing this and I do believe it's a real problem. It's just that I can't do it with the little information I have (and no reasonable test case) </p> <p> Robert Ramey </p> </description> <category>Ticket</category> </item> <item> <author>ruediger.berlich@…</author> <pubDate>Thu, 27 Jan 2011 22:21:34 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4842#comment:14 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4842#comment:14</guid> <description> <p> O.k., I'll try to be more specific: </p> <p> I'm seeing this behaviour on three systems: </p> <ul><li>Kubuntu Linux 10.10, 64 bit, g++ 4.4.5, Boost 1.44, 1.45 and current trunk version/pre-beta of 1.46 </li><li>CentOS 5.5, 64 bit, g++ 4.1.2, tested only with Boost 1.45 </li><li>I have in the past seen similar behaviour on Scientific Linux 5, which is however close to CentOS </li></ul><p> The problem does not happen with Boost 1.40 - 1.43 . </p> <p> I'd be happy to try other (Linux-)distributions you suggest. My code is so far "Linux only", so I cannot try other Operating Systems. </p> <p> I experience the problem in conjunction with our Geneva library collection (or its demo applications, to be more exact). The library is available on <a class="ext-link" href="http://www.launchpad.net/geneva"><span class="icon">​</span>http://www.launchpad.net/geneva</a>. I'm using the current trunk version of Geneva, which can be downloaded via the Bazaar version control system, e.g. with the command "bzr co lp:geneva ." . </p> <p> I'm always linking dynamically, and the problem happens both in Debug and Release mode. </p> <p> There are two libraries which involve serialization (libgemfony-geneva.so and libgemfony-geneva-individuals.so) and which get linked into all of the demo applications. I am not loading any libraries manually, but rather rely on the dynamic linker of the operating system, which loads the libraries upon program startup, likely in the order in which they were specified during the linking stage. I have tried reversing the order of the libraries in my CMake build scripts, but to no avail (it is possible that CMake has some built-in magic which always enforces a certain order). Not all of my demo applications are affected. I am currently trying to find out, which change of conditions make the problem go away. Will say so here, if I find a solution. </p> <p> Trimming down Jan Boehme's test case: I have tried to reproduce the problem with his code. As I am not a "bjam person", I have however written a CMake build script for his code. Using this, however, the problem cannot be reproduced in my main environment (Kubuntu 10.10, the same, where Geneva fails with the aforementioned "Pure virtual method called"). </p> <p> And here is an offer: If you have a means of receiving a file of maybe 2 GB, I'd be happy to set up a VMWare virtual machine (or any other VM that is free and runs both on Linux and Windows), with Kubuntu and my library installed, and send it to you. This way you could see for yourself what is happening. </p> <p> I intend to come to <a class="wiki" href="https://svn.boost.org/trac10/wiki/BoostCon">BoostCon</a> so that, if the problem still exists then, I'd be happy to work with you on a solution (assuming you will be there). </p> <p> Hope that helps. I'll try to respond on short notice, if you have further questions. In the meantime, I will try to reproduce the problem with Jan's code. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Sun, 30 Jan 2011 18:25:34 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4842#comment:15 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4842#comment:15</guid> <description> <p> Here's an idea: </p> <p> recompile void_cast.cpp with the compile time defined BOOST_SERIALIZATION_LOG </p> <p> This will emit output to standard error as different static object are created and destroyed. It is one way I use to track down these types of problems </p> <p> Robert Ramey </p> </description> <category>Ticket</category> </item> <item> <author>ruediger.berlich@…</author> <pubDate>Mon, 31 Jan 2011 20:31:56 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4842#comment:16 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4842#comment:16</guid> <description> <p> Hi Robert, here are the last few lines of the output of one of my examples ("G01Optimizer"), at the end of the program run. The total output has approx. 2000 lines, but doesn't look much different from what you see below: </p> <p> <strong> begin </strong> </p> <p> <em> [...] </em></p> <p> N3Gem6Geneva6GSwarmE&lt;-N3Gem6Geneva12GMutableSetTINS0_13GParameterSetEEE recursive_unregister N3Gem6Geneva6GSwarmE&lt;-N3Gem6Geneva23GOptimizationAlgorithmTINS0_13GParameterSetEEE recursive_unregister N3Gem6Geneva6GSwarm25GSwarmOptimizationMonitorE&lt;-N3Gem6Geneva23GOptimizationAlgorithmTINS0_13GParameterSetEE21GOptimizationMonitorTE recursive_unregister N3Gem6Geneva18GPersonalityTraitsE&lt;-N3Gem6Geneva7GObjectE recursive_unregister N3Gem6Geneva23GSwarmPersonalityTraitsE&lt;-N3Gem6Geneva7GObjectE recursive_unregister N3Gem6Geneva23GSwarmPersonalityTraitsE&lt;-N3Gem6Geneva18GPersonalityTraitsE recursive_unregister N9boost_1326detail20sp_counted_base_implIPN3Gem6Geneva14GParameterBaseEN5boost13serialization12null_deleterEEE&lt;-N9boost_1326detail15sp_counted_baseE recursive_unregister N9boost_1326detail20sp_counted_base_implIPN3Gem6Geneva18GPersonalityTraitsEN5boost13serialization12null_deleterEEE&lt;-N9boost_1326detail15sp_counted_baseE recursive_unregister N3Gem6Geneva11GIndividualE&lt;-N3Gem6Geneva7GObjectE recursive_unregister N3Gem5Tests16GTestIndividual1E&lt;-N3Gem6Geneva7GObjectE recursive_unregister N3Gem6Geneva13GParameterSetE&lt;-N3Gem6Geneva7GObjectE recursive_unregister N3Gem6Geneva12GMutableSetTINS0_14GParameterBaseEEE&lt;-N3Gem6Geneva7GObjectE recursive_unregister N3Gem5Tests16GDelayIndividualE&lt;-pure virtual method called terminate called without an active exception Abgebrochen </p> <p> <strong> end </strong> </p> <p> "Abgebrochen" means "Terminated". The example uses GFunctionIndividual. "GDelayIndividual", which appears to be the point during whose unregistration the crash happens, is never explicitly instantiated by my program. GDelayIndividual's code is located in a separate library, together with "GFunctionIndividual". It is linked to the application, and there is another dynamic library using Serialization services, which is also linked to the code. </p> <p> I have used Beta 1 of Boost 1.46, the platform is Ubuntu Linux 64 bit, g++ 4.4.5. Boost and my own code have been compiled in Debug mode. </p> </description> <category>Ticket</category> </item> <item> <author>ruediger.berlich@…</author> <pubDate>Tue, 01 Feb 2011 14:13:58 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4842#comment:17 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4842#comment:17</guid> <description> <p> Here is more information: Just to be sure that the problem is not related to GDelayIndividual, I have removed that class from the library. The error still happens, albeit when unregistering another class. Thus I am quite sure it is unrelated to my code. </p> </description> <category>Ticket</category> </item> <item> <author>crispin.boylan@…</author> <pubDate>Wed, 23 Feb 2011 08:26:22 GMT</pubDate> <title>cc changed https://svn.boost.org/trac10/ticket/4842#comment:18 https://svn.boost.org/trac10/ticket/4842#comment:18 <ul> <li><strong>cc</strong> <span class="trac-author">crispin.boylan@…</span> added </li> </ul> Ticket crispin.boylan@… Wed, 23 Feb 2011 08:40:16 GMT <link>https://svn.boost.org/trac10/ticket/4842#comment:19 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4842#comment:19</guid> <description> <p> i too see this problem on mandriva with 64 bit gcc 4.5.2. only when my program is compiled in release mode though. The boost libs are in release mode in both cases. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 16 Mar 2011 13:20:48 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4842#comment:20 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4842#comment:20</guid> <description> <p> Hi, </p> <p> Looks that I'm also experiencing this problem, my system is: </p> <ul><li>2.6.36-gentoo-<a class="changeset" href="https://svn.boost.org/trac10/changeset/5" title="Boost customization">r5</a> SMP x86_64 Intel(R) Core(TM)2 Quad CPU Q8200 @ 2.33GHz, </li><li>g++ (Gentoo 4.4.5 p1.2, pie-0.4.5) 4.4.5, </li><li>boost_1_46_0 </li></ul><p> Problem did not happen on boost_1_41, and started right after upgrading the boost (without any other code changes). </p> <p> Backtrace is: </p> <p> Program received signal SIGABRT, Aborted. 0x00007fffe4d80165 in raise () from /lib/libc.so.6 (gdb) bt <a class="missing ticket">#0</a> 0x00007fffe4d80165 in raise () from /lib/libc.so.6 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1" title="#1: Bugs: boost.build causes ftjam to segfault (closed: Wont Fix)">#1</a> 0x00007fffe4d81580 in abort () from /lib/libc.so.6 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2" title="#2: Bugs: list::size should be const (closed: fixed)">#2</a> 0x00007fffe538b695 in <span class="underline">gnu_cxx::</span>verbose_terminate_handler() () from /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/libstdc++.so.6 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3" title="#3: Bugs: automatic conversion and overload proble (closed: fixed)">#3</a> 0x00007fffe5389ac6 in <span class="underline">cxxabiv1::</span>terminate(void (*)()) () from /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/libstdc++.so.6 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4" title="#4: Bugs: any_ptr in any library documentation? (closed: Fixed)">#4</a> 0x00007fffe5389af3 in std::terminate() () from /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/libstdc++.so.6 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5" title="#5: Bugs: shared_ptr and self-owning objects (closed: Fixed)">#5</a> 0x00007fffe538a3cf in <span class="underline">cxa_pure_virtual () from /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/libstdc++.so.6 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6" title="#6: Bugs: tie in utility.hpp and tuple.hpp clash. (closed: Duplicate)">#6</a> 0x00007ffff3f93e66 in boost::serialization::void_cast_detail::void_caster::operator&lt;(boost::serialization::void_cast_detail::void_caster const&amp;) const () </span></p> <blockquote> <p> from /Data/See3D/oncomorph/2.6.36-gentoo-<a class="changeset" href="https://svn.boost.org/trac10/changeset/5/3rdParty/boost/lib/libboost_serialization" title="Boost customization">r5/3rdParty/boost/lib/libboost_serialization</a>.so.1.46.0 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7" title="#7: Bugs: g++ 2.96 requires NO_STRINGSTREAM (closed: Fixed)">#7</a> 0x00007ffff3f9477d in boost::serialization::void_cast_detail::void_caster::recursive_unregister() const () </p> <blockquote> <p> from /Data/See3D/oncomorph/2.6.36-gentoo-<a class="changeset" href="https://svn.boost.org/trac10/changeset/5/3rdParty/boost/lib/libboost_serialization" title="Boost customization">r5/3rdParty/boost/lib/libboost_serialization</a>.so.1.46.0 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8" title="#8: Bugs: prop in undirected graph + out_edges (closed: Works For Me)">#8</a> 0x00007ffff7930cc9 in boost::serialization::void_cast_detail::void_caster_virtual_base&lt;Oncomorph::Data::SliceId, Oncomorph::Persistence::Serializable&gt;::~void_caster_virtual_base() () from /Data/See3D/oncomorph/2.6.36-gentoo-<a class="changeset" href="https://svn.boost.org/trac10/changeset/5/lib/liboncomorph_base" title="Boost customization">r5/lib/liboncomorph_base</a>.so <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/9" title="#9: Bugs: config_info ambiguity error (closed: Invalid)">#9</a> 0x00007ffff7930e38 in boost::serialization::detail::singleton_wrapper&lt;boost::serialization::void_cast_detail::void_caster_virtual_base&lt;Oncomorph::Data::SliceId, Oncomorph::Persistence::Serializable&gt; &gt;::~singleton_wrapper() () from /Data/See3D/oncomorph/2.6.36-gentoo-<a class="changeset" href="https://svn.boost.org/trac10/changeset/5/lib/liboncomorph_base" title="Boost customization">r5/lib/liboncomorph_base</a>.so <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/10" title="#10: Bugs: allyourbase.jam file is bad. (closed: Out of Date)">#10</a> 0x00007fffe4d82f55 in <span class="underline">cxa_finalize () from /lib/libc.so.6 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/11" title="#11: Bugs: why not using mt19937? (closed: Fixed)">#11</a> 0x00007ffff7912dc6 in ?? () from /Data/See3D/oncomorph/2.6.36-gentoo-<a class="changeset" href="https://svn.boost.org/trac10/changeset/5/lib/liboncomorph_base" title="Boost customization">r5/lib/liboncomorph_base</a>.so <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/12" title="#12: Bugs: Can't specify VertexPredicate (closed: Fixed)">#12</a> 0x0000000000000092 in ?? () <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/13" title="#13: Bugs: iterator_adapter and abstract classes (closed: Out of Date)">#13</a> 0x0000000000000000 in ?? () </span></p> <p> thanks Julle Juntunen </p> </description> <category>Ticket</category> </item> <item> <author>Aaron Barany <akb825@…></author> <pubDate>Sat, 19 Mar 2011 00:09:47 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/4842 https://svn.boost.org/trac10/ticket/4842 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">void_cast.cpp.patch</span> </li> </ul> <p> Patch to fix the issue. </p> Ticket Aaron Barany <akb825@…> Sat, 19 Mar 2011 00:14:22 GMT <link>https://svn.boost.org/trac10/ticket/4842#comment:21 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4842#comment:21</guid> <description> <p> This issue affects not only *nix shared libraries, but also Windows DLLs. I have attached a patch that fixes this issue. However, there are still situations where this can break, which I will discuss. </p> <p> The change that caused this regression was in void_caster::recursive_unregister(). It does a loop over the entire set of registered void casters to remove all related void casters to the one being unregistered. In boost 1.43 and prior, it used to compare the pointer in the iterator to this within the loop to remove itself. However, in the boost 1.44 release that was changed to doing a find and erase after the loop. Since there are void_caster objects in the map with invalid extended type infos, that find caused a pure virtual function call. </p> <p> I think the reason why it has invalid extended type infos in the map is due to how it registers the void caster shortcuts. In void_caster::recursive_register(), it will grab the extended type info from related void_casters, but those objects could reside in another library. Since only the current void caster being registered is marked as the parent, and not the other one it gets the other extended type info from, the other extended type info can be destructed before all the void_casters that use it are unregistered. </p> <p> Though my patch, which restores the previous behavior, works around the issue during normal program startup and shutdown, if you dynamically load two libraries then later unload the first one, leaving the second library loaded, you can potentially have invalid void casters left behind to cause a crash the next lookup. Unfortunately, getting this to work properly will be very tricky, since if you simply unregister the void caster in this case, the void cast itself may still be valid, you just need a different extended type info instance to handle the comparison. I see two potential paths you can take to fix this: either set up some sort of system to replace extended type infos being destructed with valid equivalents or remove the shortcuts and use recursive lookups instead. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Sat, 19 Mar 2011 06:40:45 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4842#comment:22 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4842#comment:22</guid> <description> <p> I spent a little time looking at this. </p> <p> I looked at the stack traces (and log output) from a couple of different reports. The traces I see look like: </p> <p> ~void_caster </p> <blockquote> <p> recurrsive_unregister </p> <blockquote> <p> operator&lt; </p> </blockquote> </blockquote> <p> Or some variation - all ending with operator&lt; </p> <p> operator&lt; compares the dereferenced pointers to extended_type_info. </p> <p> I couldn't see any reason why this should occur with void_caster. I'm thinking the issue would be with extended_type_info. recurrsive_unregister invokes operator&lt; on dereferenced pointers to extended_type_info objects. </p> <p> I'm concerned that there may be multilple such objects in the map. This would occur if one included code in both the DLL and the mainline. There is a trap to detect this because I was concerned about just this problem. I had to disable this trap because it required more discipline in code organization than many could implement. I would be curious to know if those who have experienced this problem were to re-enable this trap if it would catch this issue. </p> <p> This hypothesis would also explain why the situation isn't as common as I would expect it to be if were something else. </p> <p> This trap is found and explained at basic_serializer_map.cpp line 46. Try these test cases with the following: </p> <p> a) uncomment the code at line 63 in basic_serializer_map.cp b) rebuild the library c) rerun the problem program d) let me know the results. </p> <p> I realize that this is a lot of work. But without this kind of effort, it's very difficult to make progress here. I thank all those who have invested efforts here and appreciate your patience and help. </p> <p> Robert Ramey </p> </description> <category>Ticket</category> </item> <item> <author>Aaron Barany <akb825@…></author> <pubDate>Sat, 19 Mar 2011 20:27:47 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4842#comment:23 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4842#comment:23</guid> <description> <p> Though I can't enable that trap right now, I can say without a doubt that it would be hit in my case. I have encountered other issues due to serializers being instantiated in multiple libraries, which I provided a patch for in ticket <a class="reopened ticket" href="https://svn.boost.org/trac10/ticket/5341" title="#5341: Patches: Patch to improve shared library behavior with serialization (reopened)">#5341</a>. Unfortunately, in my use case it would be nearly impossible to avoid serializing across shared library boundaries, and I'm sure that's the case for a number of other users as well. </p> <p> After looking at void_cast.cpp for a while and thinking about different situations where there are multiple instances of void_casters, I think that I have found a situation that would cause a crash. This situation can also cause a crash if everything is statically linked. </p> <p> First, I will point out an issue with the current deregistration method. The first void caster that is constructed for a particular type relation will be inserted into the set, and any duplicates will be ignored. However, since it's doing a find and remove in recursive_unregister, the frist void caster to be destructed will remove whichever void caster was registered for that type relation, since it's comparing the type infos. For example, if you have void casters A and B, which both represent the same base and derived types, A will be registered on construction, while B will be ignored. On destruction, B will be destructed first and remove A. With the previous behavior, it was comparing pointers, so B wouldn't find itself in the set, and A wouldn't be unregistered until A was destructed. </p> <p> I will now lay out a particular case where this unregistration behavior can cause a crash. Lets say you have a class hierarchy of A, B, C, and D, where A is the base class and D is the most derived class. If void casters are registered for A-&gt;B, B-&gt;C, and C-&gt;D, shortcuts will be made along the way. Depending on the order of initialization, such as if C-&gt;D is registered before B-&gt;C, those shortcuts can then then recursively create shortcuts of their own. In this example, let's say the shortcut B-&gt;D recursively creates the shortcut A-&gt;D, so the parent of A-&gt;D is the shortcut for B-&gt;D. </p> <p> Now we have our hierarchy of void casters set up. However, let's say somewhere else in code the void caster B-&gt;D is registered directly, and is constructed after all the void casters and resulting shortcuts above. That void caster will see the B-&gt;D shortcut registered already, and won't insert it into the set. When the program shuts down, that explicit B-&gt;D void caster will be destructed first, since it was constructed last. When that void caster is destructed, recursive_unregister will do a find for the B-&gt;D type relation, and end up removing the shortcut registered earlier. That shortcut is merely removed from the set, and is never actually deleted, so it is leaked. As a result of that, the A-&gt;D shortcut created by the B-&gt;D shortcut is never removed from the set, since its parent's destructor is never called and is never recursively unregistered. At some point, the type infos for A and D are destroyed, but that A-&gt;D shortcut that references them is still left in the set. If there are still void casters registered at that point, the next time a find is performed, it will crash with the pure virtual function call. </p> <p> Since order of construction at startup isn't guaranteed, this specific ordering can occur regardless of if shared libraries are used or not. This will generally occur if you are serializing polymorphic type hierarchies by base pointer, as that serialization will register an explicit void caster that can skip over multiple classes in the hierarchy and conflict with an existing shortcut. I think there has been a correlation with the use of shared libraries and experiencing this bug since projects with large and complex type hierarchies are more likely to use shared libraries. </p> </description> <category>Ticket</category> </item> <item> <author>ruediger.berlich@…</author> <pubDate>Sun, 20 Mar 2011 09:54:42 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4842#comment:24 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4842#comment:24</guid> <description> <p> Hi Robert, </p> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/4842#comment:22" title="Comment 22">anonymous</a>: </p> <blockquote class="citation"> <p> a) uncomment the code at line 63 in basic_serializer_map.cp b) rebuild the library c) rerun the problem program d) let me know the results. </p> </blockquote> <p> I did this and there is no change at all (i.e. the trap doesn't trigger, program runs through as normal and crashes at the end with message "pure virtual method called"). </p> <p> Best Regards, Ruediger </p> </description> <category>Ticket</category> </item> <item> <author>ruediger.berlich@…</author> <pubDate>Sun, 20 Mar 2011 10:11:59 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4842#comment:25 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4842#comment:25</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/4842#comment:24" title="Comment 24">ruediger.berlich@…</a>: </p> <blockquote class="citation"> <p> I did this and there is no change at all (i.e. the trap doesn't trigger, program runs through as normal and crashes at the end with message "pure virtual method called"). </p> </blockquote> <p> I have now also tried Aaron's patch (with Robert's trap still active). </p> <p> For all programs I have tried it fixes the problem ... </p> <p> This was done on Ubuntu Linux 10.10 / 64 bit, g++ 4.4.5 . </p> <p> Note that the Geneva library is a toolkit, so I have to run further tests to see whether this cures the problem in all our usage scenarios. I am travelling at the moment, so I can only run further tests when I am back. </p> <p> Best Regards, Ruediger </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Sun, 20 Mar 2011 10:16:03 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4842#comment:26 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4842#comment:26</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/4842#comment:25" title="Comment 25">ruediger.berlich@…</a>: </p> <blockquote class="citation"> <p> This was done on Ubuntu Linux 10.10 / 64 bit, g++ 4.4.5 . </p> </blockquote> <p> Apologies for repeatedly replying to myself. But I guess it is important to note that I have used Boost 1.46.1 for the tests above. I am not linking statically, and serialized classes come from different dynamic libraries in my test programs. </p> <p> Best Regards, Ruediger </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Mon, 21 Mar 2011 12:09:02 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4842#comment:27 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4842#comment:27</guid> <description> <p> Hi Robert, Aaron </p> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/4842#comment:22" title="Comment 22">anonymous</a>: </p> <blockquote class="citation"> <p> a) uncomment the code at line 63 in basic_serializer_map.cp b) rebuild the library c) rerun the problem program d) let me know the results. </p> </blockquote> <p> <br /> I tried this but the problem occurs just as before. </p> <p> The patch by Aaron, however, fixes the problem. </p> <p> br. <br /> Julle Juntunen </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Sun, 10 Apr 2011 00:00:46 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4842#comment:28 https://svn.boost.org/trac10/ticket/4842#comment:28 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> I've tested Aaron's patch and committed it to the trunk. I'm taking everyone's word for it that this is the fix as I can't reproduce it myself. </p> <p> Robert Ramey </p> Ticket Bryce Adelstein Lelbach Wed, 11 May 2011 02:41:44 GMT <link>https://svn.boost.org/trac10/ticket/4842#comment:29 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4842#comment:29</guid> <description> <p> Ramey, for whatever peace of mind it's worth, Aaron's patch fixed a serious issue in the codebase which Hartmut and I work on. Thanks for applying, this resolves a big headache for me. </p> </description> <category>Ticket</category> </item> </channel> </rss>