GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||
GeezerVison is showing github.com — Auto-port 5.0: Fix direct memory OOM on low-core containers by netty-project-bot · Pull Request #17188 · netty/netty Conversation
Contributor
Auto-port of #17166 to 5.0 Motivation: PR #16766 introduced SHARED_CACHE_CAPACITY = max(128, CHUNK_REUSE_QUEUE * 2) to prevent chunk churn. On 1-core containers where CHUNK_REUSE_QUEUE is 2, the 128-slot floor allows each of the 16 size classes to retain up to 128 chunks of ~128 KB, totalling 256 MB of direct memory in caches alone. On JDK 21 without -Dio.netty.tryReflectionSetAccessible=true, Netty allocates direct chunks via ByteBuffer.allocateDirect(), tracked against MaxDirectMemorySize. The cache capacity can exhaust the entire direct memory budget, causing OOM as reported in #17107. Additionally, IS_LOW_MEM (triggered when Runtime.maxMemory() <= 512 MB) uses heap budget as a proxy for native memory availability, which is wrong for off-heap workloads. There is no override for users who know their environment better than the heuristic. Modification:
Result: Worst-case cache retention drops from 256 MB to 32 MB on 1-4 core machines. The CHUNK_REUSE_QUEUE * 2 formula still governs on 8+ cores (128 on 32 cores — same as before). The floor of 16 is 8x the pre-#16766 capacity on 1-core, so the original chunk churn problem does not regress. Users can force IS_LOW_MEM on or off via -Dio.netty.allocator.lowMemory.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsMotivation: PR #16766 introduced SHARED_CACHE_CAPACITY = max(128, CHUNK_REUSE_QUEUE * 2) to prevent chunk churn. On 1-core containers where CHUNK_REUSE_QUEUE is 2, the 128-slot floor allows each of the 16 size classes to retain up to 128 chunks of ~128 KB, totalling 256 MB of direct memory in caches alone. On JDK 21 without -Dio.netty.tryReflectionSetAccessible=true, Netty allocates direct chunks via ByteBuffer.allocateDirect(), tracked against MaxDirectMemorySize. The cache capacity can exhaust the entire direct memory budget, causing OOM as reported in #17107. Additionally, IS_LOW_MEM (triggered when Runtime.maxMemory() <= 512 MB) uses heap budget as a proxy for native memory availability, which is wrong for off-heap workloads. There is no override for users who know their environment better than the heuristic. Modification: - Reduce the SHARED_CACHE_CAPACITY floor from 128 to 16. - Add io.netty.allocator.lowMemory system property to override IS_LOW_MEM auto-detection, following the precedent of the existing disableThreadLocalMagazinesOnLowMemory property. Result: Worst-case cache retention drops from 256 MB to 32 MB on 1-4 core machines. The CHUNK_REUSE_QUEUE * 2 formula still governs on 8+ cores (128 on 32 cores — same as before). The floor of 16 is 8x the pre-#16766 capacity on 1-core, so the original chunk churn problem does not regress. Users can force IS_LOW_MEM on or off via -Dio.netty.allocator.lowMemory. --------- Co-authored-by: Chris Vest <[email protected]> (cherry picked from commit 6b02a3e)
|
There was an error while loading. Please reload this page.
🚨 TestLens detected 1 failed test 🚨Here is what you can do:
Test SummaryBuild PR / macos-x86_64-java25-boringssl build > Netty/Transport/Native/KQueue
🏷️ Commit: 9a13098 Test FailuresKQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeHeapByteBuf(TestInfo) (Netty/Transport/Native/KQueue in Build PR / macos-x86_64-java25-boringssl build)Muted TestsSelect tests to mute in this pull request:
Reuse successful test results:
Click the checkbox to trigger a rerun:
Learn more about TestLens at testlens.app. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.