Skip to content

Fix json_stats mutexes test for configurable MALLCTL_ARENAS_ALL#9

Merged
jimwwalker merged 1 commit into
couchbasedeps:5.3.1-couchbasefrom
jimwwalker:5.3.1-couchbase
Jul 7, 2026
Merged

Fix json_stats mutexes test for configurable MALLCTL_ARENAS_ALL#9
jimwwalker merged 1 commit into
couchbasedeps:5.3.1-couchbasefrom
jimwwalker:5.3.1-couchbase

Conversation

@jimwwalker

Copy link
Copy Markdown

test_json_stats_mutexes hard-coded the arena index 4096 in the mallctl name "stats.arenas.4096.mutexes...", assuming MALLCTL_ARENAS_ALL == 4096. That holds only for the default tcache limit. Our downstream --with-lg-tcache-limit patch makes MALLCTL_ARENAS_ALL a configure-computed value of 2^(24 - limit): at the limit=15 we build with, it is 512, not 4096. The test then queried a non-existent arena index and mallctl returned ENOENT, failing every assertion in the merged-arena mutex loop.

Stringify the MALLCTL_ARENAS_ALL macro instead of hard-coding the value, matching the usage documented in jemalloc_macros.h. The test now passes for any --with-lg-tcache-limit setting; the change is test-only and does not affect the library.

test_json_stats_mutexes hard-coded the arena index 4096 in the
mallctl name "stats.arenas.4096.mutexes...", assuming
MALLCTL_ARENAS_ALL == 4096.  That holds only for the default
tcache limit.  Our downstream --with-lg-tcache-limit patch makes
MALLCTL_ARENAS_ALL a configure-computed value of 2^(24 - limit):
at the limit=15 we build with, it is 512, not 4096.  The test then
queried a non-existent arena index and mallctl returned ENOENT,
failing every assertion in the merged-arena mutex loop.

Stringify the MALLCTL_ARENAS_ALL macro instead of hard-coding the
value, matching the usage documented in jemalloc_macros.h.  The
test now passes for any --with-lg-tcache-limit setting; the change
is test-only and does not affect the library.

@pavlosg pavlosg left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jimwwalker
jimwwalker merged commit 96030e9 into couchbasedeps:5.3.1-couchbase Jul 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants