khizmax / libcds

A C++ library of Concurrent Data Structures
http://libcds.sourceforge.net/doc/cds-api/index.html
Boost Software License 1.0
2.57k stars 358 forks source link

test-hdr Assertion `m_nTop > 0' failed #34

Closed khegeman closed 9 years ago

khegeman commented 9 years ago

assertion happens on linux with both g++ 4.8 and clang 3.5

test-hdr: libcds/cds/gc/details/hp_alloc.h:236: cds::gc::hp::details::hp_allocator<Allocator>::atomic_hazard_ptr& cds::gc::hp::details::hp_allocator<Allocator>::alloc() [with Allocator = std::allocator<int>; cds::gc::hp::details::hp_allocator<Allocator>::atomic_hazard_ptr = cds::gc::hp::details::hp_guard]: Assertion `m_nTop > 0' failed.

It happens during this test

CPPUNIT_TEST(split_dyn_HP_base_cmp)

CMAKE_BUILD_TYPE=DEBUG

with clang, I used libc++. CMAKE_CXX_FLAGS=-stdlib=libc++

khegeman commented 9 years ago

I get a similar error on the cdsu-set test

Set_DelOdd::SkipListSet_hp_less_pascal
        Insert thread count=8 delete thread count=4 extract thread count=4 set size=1000000
        EXCEPTION: 
        Too few hazard pointersSet_InsDelFind::MichaelSet_HP_cmp_stdAlloc
        Thread count=8 initial map size=500000 insert=5% delete=5% duration=30s
        Load factor=1
khizmax commented 9 years ago

I think, Hazard Pointer SMR is initialized by default. Usually, it means that no test.conf (or test-debug.conf for debug build) is provided for test. By default, test suite uses ./test.conf (for debug build - ./test-debug.conf). The example of those files is located in tests/data directory.

The top of test report tells the count of Hazard Pointer like this:

Use in-place scan strategy for Hazard Pointer memory reclamation algorithm Hazard Pointer count: 72 Max thread count for HP: 100 Retired HP array capacity: 1600

khegeman commented 9 years ago

That was exactly what was happening. I submitted a pull request to copy the conf files to the bin directory when cmake is run.