[Backport to 6.1] util/backtrace: Optimize formatter to reduce memory allocation overhead #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit addresses a critical memory allocation issue in backtrace formatting by directly specializing fmt::formatter for backtrace types, eliminating dependency on iostream-based formatting.
Problem:
When Seastar applications experience high memory pressure, logging backtrace information could fail due to additional memory allocation required by iostream formatting. This resulted in errors like:
Solution:
Compatibility Improvements:
fmt::formatter
availability across fmt library versionssimple_backtrace
constructors previously added in 095a07b, as they are no longer needed with fmt::joinImpact:
This change enhances system resilience by enabling backtrace logging even under significant memory pressure, providing more reliable post-mortem debugging information.
Signed-off-by: Kefu Chai kefu.chai@scylladb.com
(cherry picked from commit 3133ecd)
Parent PR: scylladb/seastar#2572
Refs scylladb/scylladb#22727