feat: custom netty memory-segment based buffer impl#1655
Merged
Conversation
…stom-memseg-buffer
Test Results 52 files + 1 52 suites +1 2m 51s ⏱️ + 1m 30s Results for commit cdbcb80. ± Comparison against base commit 5b02c06. This pull request removes 37 and adds 109 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
0utplay
approved these changes
Jun 17, 2025
derklaro
added a commit
to CloudNetService/module-rest
that referenced
this pull request
Jun 18, 2025
This is possible again with our custom memory-segment buffers (they are now allocated in the global arena which isn't restricted). Depends on CloudNetService/CloudNet#1655
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
We're currently using the default memory segment backed buffer implementation provided by netty. While this implementation works, there are still some issues with it. These were resolved in upstream but never published due to the central-portal migration that wasn't done for netty5 yet.
Modification
Add a custom netty buffer implementation that is backed by memory segments with a few modifications:
mallocand freed usingfree. This means that we're not using the Arena implementations provided by the jdk (specifically the shared arena), as closing them provides a performance bottleneck due to a required thread handshake to prevent uaf. This can be quite expensive depending on the count of active threads.Result
We're using a custom mememory-segment backed buffer implementation that doesn't contain some upstream bugs and is faster to deallocate.