8a1a794b0c
Some bug (either in the red-black tree code, or in the pgi compiler) seems to cause red-black trees to become unbalanced. This issue seems to go away if we don't use compact red-black trees. Since red-black trees don't seem to be used much anymore, I opted for what seems to be an easy fix here instead of digging in and trying to find the root cause of the bug. Some context in case it's helpful: I experienced a ton of segfaults while using pgi as Chapel's target compiler with jemalloc 4.0.4. The little bit of debugging I did pointed me somewhere deep in red-black tree manipulation, but I didn't get a chance to investigate further. It looks like 4.2.0 replaced most uses of red-black trees with pairing-heaps, which seems to avoid whatever bug I was hitting. However, `make check_unit` was still failing on the rb test, so I figured the core issue was just being masked. Here's the `make check_unit` failure: ```sh === test/unit/rb === test_rb_empty: pass tree_recurse:test/unit/rb.c:90: Failed assertion: (((_Bool) (((uintptr_t) (left_node)->link.rbn_right_red) & ((size_t)1)))) == (false) --> true != false: Node should be black test_rb_random:test/unit/rb.c:274: Failed assertion: (imbalances) == (0) --> 1 != 0: Tree is unbalanced tree_recurse:test/unit/rb.c:90: Failed assertion: (((_Bool) (((uintptr_t) (left_node)->link.rbn_right_red) & ((size_t)1)))) == (false) --> true != false: Node should be black test_rb_random:test/unit/rb.c:274: Failed assertion: (imbalances) == (0) --> 1 != 0: Tree is unbalanced node_remove:test/unit/rb.c:190: Failed assertion: (imbalances) == (0) --> 2 != 0: Tree is unbalanced <jemalloc>: test/unit/rb.c:43: Failed assertion: "pathp[-1].cmp < 0" test/test.sh: line 22: 12926 Aborted Test harness error ``` While starting to debug I saw the RB_COMPACT option and decided to check if turning that off resolved the bug. It seems to have fixed it (`make check_unit` passes and the segfaults under Chapel are gone) so it seems like on okay work-around. I'd imagine this has performance implications for red-black trees under pgi, but if they're not going to be used much anymore it's probably not a big deal. |
||
---|---|---|
.. | ||
arena.h | ||
assert.h | ||
atomic.h | ||
base.h | ||
bitmap.h | ||
chunk.h | ||
ckh.h | ||
ctl.h | ||
extent_dss.h | ||
extent_mmap.h | ||
extent.h | ||
hash.h | ||
jemalloc_internal_decls.h | ||
jemalloc_internal_defs.h.in | ||
jemalloc_internal_macros.h | ||
jemalloc_internal.h.in | ||
large.h | ||
mb.h | ||
mutex.h | ||
nstime.h | ||
pages.h | ||
ph.h | ||
private_namespace.sh | ||
private_symbols.txt | ||
private_unnamespace.sh | ||
prng.h | ||
prof.h | ||
public_namespace.sh | ||
public_unnamespace.sh | ||
ql.h | ||
qr.h | ||
rb.h | ||
rtree.h | ||
size_classes.sh | ||
smoothstep.h | ||
smoothstep.sh | ||
stats.h | ||
tcache.h | ||
ticker.h | ||
tsd.h | ||
util.h | ||
witness.h |