apache / apache/bookkeeper

[feat] Add observability to OutOfMemoryErrors when OutOfMemoryPolicy is FallbackToHeap

Open
#4,534 1 comment 0 reactions 0 assignees View on GitHub
type/feature
Dominant language
Java
Stars
2k
Forks
976
Avg merge
6d 15h
Merged PRs (30d)
7

Description

**FEATURE REQUEST**

Currently when direct memory allocation fails with OutOfMemoryError, the default OutOfMemoryPolicy is `FallbackToHeap` and the exception is catched silently:

https://github.com/apache/bookkeeper/blob/b372e9031e3f43adc831947332a6852680e750db/bookkeeper-common-allocator/src/main/java/org/apache/bookkeeper/common/allocator/impl/ByteBufAllocatorImpl.java#L174-L187

It would be great to be able to observe this condition. Pulsar uses ByteBufAllocatorImpl also for Pulsar client and it's hard to detect that Netty direct buffer direct access isn't properly configured unless there's a way to observe the condition.
Netty direct memory buffer access is explained in Pulsar client's "Java client Performance considerations", https://pulsar.apache.org/docs/4.0.x/client-libraries-java-setup/#java-client-performance .

After there's a counter in ByteBufAllocatorImpl, it would be possible to implement a metric in Pulsar client.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.