DragonFly BSD
DragonFly bugs List (threaded) for 2009-09
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: [issue1525] boehm-gc problems


From: Jordan Gordeev <jgordeev@xxxxxx>
Date: Mon, 28 Sep 2009 19:14:13 +0300

I'll summarize what I've learned so far.
Boehm GC is a mark-sweep garbage collector.
The crashes and the hangs happen because the GC garbage collects its own internal data structures.
How could this happen?! Easy.
The mark procedure starts marking objects as reachable beginning from a number of root regions, which include, but are not limited to, the program's global data area and the global data areas of dynamically loaded libraries. Unfortunately, on DragonFly, the latter part doesn't work as intended. So, the garbage collector, which itself is a dynamically loaded library, doesn't mark its own data structures, and the sweeper frees the memory they occupy.
In the source code of the GC, functions of interest are GC_add_roots_inner() in mark_rts.c and GC_FirstDLOpenedLinkMap(), starting at line 493, in dyn_load.c.
GC_add_roots_inner() should get called once for the main executable and for each dynamic library loaded.
In GC_FirstDLOpenedLinkMap() we start from _DYNAMIC and in a loop try to find a Elf_Dyn entry with tag DT_DEBUG.
On DragonFly, the main executable has such an entry, however when GC_FirstDLOpenedLinkMap() iterates over the list it seems to iterate over the list of entries of libgc - a dynamic library which lacks DT_DEBUG entries in its .dynamic section. The DT_DEBUG entry we are looking for isn't found.
On FreeBSD, when we iterate over the list, we get a list of tags that is a prefix of the tags of the main executable.
The tags on the main executable:
1 1 1 15 12 13 4 5 6 10 11 21 20 23 17 18 19 0x6ffffffe 0x6fffffff 0x6ffffff0
What we get:
1 1 1 15 12 13 4 5 6 10 11 21



I'm leaving this problem report for now, to let my head recover. If you've got any ideas, please let me know.


Here's some less important stuff:
And now, to see how well FreeBSD fares. Building the Boehm GC on FreeBSD 7.1 and running 'gmake check' produces:
Boehm GC version 6.8 built from ports:
FAIL: gctest
PASS: test_cpp
==================================
1 of 2 tests failed
Please report to Hans.Boehm@hp.com
==================================


Boehm GC version 6.8 built manually:
PASS: gctest
==================
All 1 tests passed
==================

Boehm GC version 7.1 built manually:
PASS: gctest
PASS: leaktest
PASS: middletest
PASS: smashtest
PASS: hugetest
PASS: threadleaktest
==================
All 6 tests passed
==================




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]