Skip to content
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

[#2060] fix(server): Fix memory leaks when reaching memory limit #2058

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,21 @@ private static Map<Integer, List<ShuffleBlockInfo>> decodePartitionData(ByteBuf
int lengthOfShuffleBlocks = byteBuf.readInt();
List<ShuffleBlockInfo> shuffleBlockInfoList = Lists.newArrayList();
for (int j = 0; j < lengthOfShuffleBlocks; j++) {
shuffleBlockInfoList.add(Decoders.decodeShuffleBlockInfo(byteBuf));
try {
shuffleBlockInfoList.add(Decoders.decodeShuffleBlockInfo(byteBuf));
} catch (Throwable t) {
// An OutOfDirectMemoryError will be thrown, when the direct memory reaches the limit.
// OutOfDirectMemoryError will not cause the JVM to exit, but may lead to direct memory
// leaks.
// Note: You can refer to docs/server_guide.md to set MAX_DIRECT_MEMORY_SIZE to a
// reasonable value.
shuffleBlockInfoList.forEach(sbi -> sbi.getData().release());
partitionToBlocks.forEach(
(integer, shuffleBlockInfos) -> {
shuffleBlockInfos.forEach(sbi -> sbi.getData().release());
});
throw t;
}
}
partitionToBlocks.put(partitionId, shuffleBlockInfoList);
}
Expand Down
Loading