RE: [Boost-users] Re: MultiIndexSet invariant test failure
OK, this is a different story. Yes, unfortunately.
2. The comparison predicate you're passing is not correct (i.e. it does not implement a strict weak ordering.) OK, this is possible. I'm using a function object. What exactly does it mean to implement strict weak ordering? I need to search the documentation again...
3. Elements are dynamic (pointers to objects) and you did a premature delete on one or some of them. I'm using boost::shared_ptr types, so they shouldn't get cleaned up while they are contained by the MultiIndexSet. However, I'm starting to suspect that the shared_ptrs are not behaving well.
5. You're running out of memory and new() does not throw bad_alloc (this can happen in MSVC++ 6.5 and, maybe, 7.0.) I'm using gcc on RHEL3; I don't believe this is happening.
6. You haven't selected a multithreaded version of the runtime library. I need to investigate this; what 'runtime library' are you referring to?
7. You guarded write access to an index but *not* to other indices of the same container. I gaurded ~everything~ ;)
Questions:
1. I'd like to analyze this. I can run tests in GCC/Cygwin. Could your
test be run on this platform? If not, could you at least disclose the code so that I can take a look at it? We're developing on the linux platform, so that's not a barrier, but unfortunately, it will be very difficult to convince my employer to allow me to disclose any code. Thank you, however, for offering to analyze it.
2. Does your debugging environment allow you to peek at the variables when the assert happens? I'm using some acient version of gdb/ddd. I could try, although I'm not sure how to do that yet.
Thank *you* for reporting the problem. Sure, although it's probably something I'm doing wrong. I really do appreciate your help. This MultiIndexSet is perfect for my needs; I just need to get it working right!
Manges, Ross G
2. The comparison predicate you're passing is not correct (i.e. it does not implement a strict weak ordering.) OK, this is possible. I'm using a function object. What exactly does it mean to implement strict weak ordering? I need to search the documentation again...
You've got to implement semantics equivalent to that of the < relationship between numbers: http://www.sgi.com/tech/stl/StrictWeakOrdering.html
6. You haven't selected a multithreaded version of the runtime library. I need to investigate this; what 'runtime library' are you referring to?
The C/C++ standard library. I'm no GCC expert, check -pthreads and related compiler options. I've got an idea that might help to determine where the problem is actually happening. Invariant checking is performed at the end of every write member function (in your case, insert()). There are two possibilities: 1. Invariant is OK before calling insert() and the insertion itself breaks it. 2. The invariant is already broken by the time you call insert() (by some side effect in some other thread, for instance.) To determine whether we're dealing with 1 or 2, could you please do the following? * In line 513 of multi_index_container.hpp there's a protected member function called check_invariant_: void check_invariant_()const { BOOST_MULTI_INDEX_INVARIANT_ASSERT(invariant_()); } * Make this member function public by modifying multi_index_container.hpp (you might want to backup the header first): public: void check_invariant_()const { BOOST_MULTI_INDEX_INVARIANT_ASSERT(invariant_()); } * Now, in the piece of your code where the insert asserts, add a precheck of the invariant: m.check_invariant_(); // point A m.insert(...); // point B * Run your test till the assert fires. Is it in point A or B? If A, then most likely you're somehow modifying the elements in some other thread. Get the idea? Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
participants (2)
-
Joaquin M Lopez Munoz
-
Manges, Ross G