-
Notifications
You must be signed in to change notification settings - Fork 760
Fix/issue #1013 aarch64 allocator #1030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/issue #1013 aarch64 allocator #1030
Conversation
Enables HTTP/2 keepalives and TCP keepalives in gRPC client to detect dead nodes (e.g., power loss) in ~8 seconds, preventing cluster hangs.
…fs#1013) - Switch allocator from jemalloc to mimalloc on AArch64 Linux targets to resolving 'Unsupported system page size' panic. - Retain jemalloc for x86_64/GNU Linux for performance. - Add cfg guards in profiling.rs to handle missing jemalloc features on AArch64. - Added detailed resolution report in docs/.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR addresses a critical startup crash on Raspberry Pi 5 and other AArch64 Linux systems caused by a page size mismatch between jemalloc's compiled 4KB page size and the kernel's 16KB/64KB runtime configuration. The solution implements architecture-aware allocator selection to ensure stability across platforms.
Key Changes:
- Dynamic allocator selection: mimalloc for AArch64 systems, jemalloc retained for x86_64 GNU environments
- Conditional compilation guards in profiling module to handle jemalloc-specific features gracefully on AArch64
- Comprehensive technical documentation explaining the root cause, solution, and verification methodology
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
rustfs/Cargo.toml |
Updated target-specific dependencies to exclude jemalloc on AArch64 and include mimalloc; separated pprof for CPU profiling from jemalloc-specific dependencies |
rustfs/src/main.rs |
Modified global allocator selection with conditional compilation to use mimalloc on AArch64 and musl, jemalloc on x86_64 GNU |
rustfs/src/profiling.rs |
Added architecture-specific guards for jemalloc-dependent memory profiling functions, providing graceful error messages on AArch64 |
docs/bug_resolution_report_issue_1013.md |
New technical documentation detailing the bug analysis, solution strategy, implementation, and verification process |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| ## 5. Implementation Details | ||
|
|
||
| The fix was implemented across three key areas of the codebase to ensuring "Secure by Design" principles. |
Copilot
AI
Dec 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The phrase "Secure by Design" is used in quotes but isn't clearly connected to the allocator fix. This security design principle typically refers to proactive security measures in software design, but switching allocators for compatibility isn't primarily a security concern—it's a stability/compatibility fix.
Consider removing the "Secure by Design" reference or clarifying how it applies to this specific fix, as it may confuse readers about the nature of the issue being addressed.
| The fix was implemented across three key areas of the codebase to ensuring "Secure by Design" principles. | |
| The fix was implemented across three key areas of the codebase to ensure stability and compatibility. |
| libsystemd.workspace = true | ||
|
|
||
| [target.'cfg(all(target_os = "linux", target_env = "musl"))'.dependencies] | ||
| [target.'cfg(any(all(target_os = "linux", target_env = "musl"), all(target_os = "linux", target_arch = "aarch64")))'.dependencies] |
Copilot
AI
Dec 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The target configuration could be simplified for better readability. Since both conditions require target_os = "linux", consider:
[target.'cfg(all(target_os = "linux", any(target_env = "musl", target_arch = "aarch64")))'.dependencies]This is more concise and equally correct.
| [target.'cfg(any(all(target_os = "linux", target_env = "musl"), all(target_os = "linux", target_arch = "aarch64")))'.dependencies] | |
| [target.'cfg(all(target_os = "linux", any(target_env = "musl", target_arch = "aarch64")))'.dependencies] |
|
@Jitterx69 It is recommended to use tools like |
Do you want to do a PR again with the revisions ? |
Please modify all of them directly and submit them directly in this PR. Thank you |
|
@Jitterx69 Thank you! Please refer to Copilot's tips for further improvement and optimization. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| ## 5. Implementation Details | ||
|
|
||
| The fix was implemented across three key areas of the codebase to ensuring "Secure by Design" principles. |
Copilot
AI
Dec 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammatical issue: "to ensuring" should be "to ensure". The infinitive form should be used after "to".
| The fix was implemented across three key areas of the codebase to ensuring "Secure by Design" principles. | |
| The fix was implemented across three key areas of the codebase to ensure "Secure by Design" principles. |
Type of Change
Related Issues
Closes #1013
Summary of Changes
This PR fixes a critical startup crash (
<jemalloc>: Unsupported system page size) affecting Raspberry Pi 5 and other AArch64 Linux systems caused by a mismatch between jemalloc's compiled page size (4KB) and the kernel's runtime configuration (16KB/64KB).Key Changes:
mimalloc, which is page-size agnostic and robust on ARM hardware.tikv-jemallocatorfrom AArch64 builds and linkmimallocinstead.#[cfg(not(target_arch = "aarch64"))]guards in profiling.rs to handle missing jemalloc features gracefully on ARM, replacing panics with error logs.Checklist
make pre-commit(Verified build viacargo checkand fix syntax)Impact
Additional Notes
Verification:
I mathematically verified the fix using
cargo treeto prove that the crashing library (jemalloc) is completely removed from the AArch64 dependency graph, while the safe replacement (mimalloc) is correctly linked. Full verification details are available in the attached resolution report.Thank you for your contribution! Please ensure your PR follows the community standards (CODE_OF_CONDUCT.md) and sign the CLA if this is your first contribution.