Created attachment 709527 [details, diff]
The attached patch introduces the USE flag "large" to dev-libs/boehm-gc that sets a larger value for MAX_ROOTS and thus prevents applications like app-office/gnucash from crashing
I have a fairly large accounting file that has grown more than 15 years. When exporting that data as "Transactions CSV" and then reimporting them "from CSV", GnuCash crashes when I select the "GnuCash" CSV import preset. More precisely dev-libs/boehm-gc calls "abort" giving the reason "No more root sets" during a garbage collection run.
A hard coded value MAX_ROOTS in dev-libs/boehm-gc defines how many root sets are permissible and the ./configure script option --enable-large-config can set MAX_ROOTS reasonably big, however there is currently no way to enable it in dev-libs/boehm-gc src_configure().
I didn't dig into boehm-gc to find out the rationale for the limit, but I am assuming it is a question of performance and/or memory. The protection thereby is probably for resource limited systems (think embedded). I can't really conjecture a situation where forcefully failing garbage collection with SIGABRT is better than just waiting a little bit longer and potentially have big amounts of memory freed. There might be, though.
The attached patch enables "large config" by default for dev-libs/boehm-gc unless disabled by USE=-large. If a more conservative solution would be required, I could think of these two alternatives:
* Setting REQUIRE_USE to allow "large" only on machine architectures that are more likely not resource constrained (i.e. x86 and amd64, but not arm).
* Setting IUSE=large (thus it being not enabled by default), but then depending on dev-libs/boehm-gc[large] from applications that crash with "No more root sets" such as app-office/gnucash
Just-in-case it matters, could you provide output of:
emerge --info app-office/gnucash dev-libs/boehm-gc
(tentatively assigned to boehm-gc because of the patch)
The bug has been referenced in the following commit(s):
Author: Dirk Tilger <email@example.com>
AuthorDate: 2021-05-18 02:37:31 +0000
Commit: Sergei Trofimovich <firstname.lastname@example.org>
CommitDate: 2021-05-19 22:51:40 +0000
dev-libs/boehm-gc: Enables boehm-gc with large root sets
This disables the 'No more root sets' error message for programs dealing
with large datasets (i.e. GnuCash data import)
Signed-off-by: Dirk Tilger <email@example.com>
Signed-off-by: Sergei Trofimovich <firstname.lastname@example.org>
dev-libs/boehm-gc/boehm-gc-8.0.4.ebuild | 3 ++-
dev-libs/boehm-gc/metadata.xml | 11 +++++++----
2 files changed, 9 insertions(+), 5 deletions(-)
I pulled your patch almost as is with minor changes around metadata declaration. I think it's useful on it's own.
Glancing at code around LARGE_CONFIG it looks like a limitation of boehm-gc of not being able to handle large amount of root pointers. I wonder if it means that app-office/gnucash should change strategy of exposing reachable GC pointers to boehm-gc via APIs other than individual GC roots (via single indirect data structure).
Nothing to do here anymore.