Skip to content

Use assertions to check for failed allocations

It was discovered that named could crash due to a segmentation fault when jemalloc was in use and memory allocation failed. This was not intended to happen as jemalloc's "xmalloc" option was set to "true" in the "malloc_conf" configuration variable. However, that variable was only set after jemalloc was already done with parsing it, which effectively caused setting that variable to have no effect.

While investigating this issue, it was also discovered that enabling the "xmalloc" option makes jemalloc use a slow processing path, decreasing its performance by about 25%. [1]

Additionally, further testing (carried out after fixing the way "malloc_conf" was set) revealed that the non-default configuration options do not have any measurable effect on either authoritative or recursive DNS server performance.

Replace code setting various jemalloc options to non-default values with assertion checks of mallocx()/rallocx() return values.

[1] https://github.com/jemalloc/jemalloc/pull/523

Closes #2921 (closed)

Edited by Michał Kępień

Merge request reports