Hi Yan,

So I suggest that we introduce a new jvm param
> `preferNettyLeakDetectionPolicy` in bookkeeper, the default value is
> `false`.
>
> If the user config `-DpreferNettyReLeakDetectionPolicy=true`, the
> bookkeeper leak detection policy won't override the netty config. If the ci
> tests, we config `-Dio.netty.leakDetection.level=paranoid
> -DpreferNettyLeakDetectionPolicy=true`, it will use netty leak detection
> level `paranoid`.
>

According to the original PR's motivation
<https://github.com/apache/bookkeeper/pull/1754>, we wrapped a Netty
allocator
and want to configure something through bookkeeper.
So the user will use our customized allocator and need to obey the rules
we introduced. Then the Netty's configuration `io.netty.leakDetection.level`
seems useless for us. I think they would never have a chance to take it
differently.

We defined a new configuration property to configure the
LeakDetectionPolicy.




*public LeakDetectionPolicy getAllocatorLeakDetectionPolicy() {
return LeakDetectionPolicy
.valueOf(this.getString(ALLOCATOR_LEAK_DETECTION_POLICY,
LeakDetectionPolicy.Paranoid.toString()));    }*

Some users may don't know the `*ALLOCATOR_LEAK_DETECTION_POLICY`*
and only configure* `*io.netty.leakDetection.level` to open the leak
detection.
I would suggest getting both `*ALLOCATOR_LEAK_DETECTION_POLICY`*
and `io.netty.leakDetection.level` from the system property, use the highest
policy of it. And then, no matter how you configured it, the detection
policy always worked.


Thanks,
Yong


On Mon, 20 Feb 2023 at 10:02, Yan Zhao <horizo...@apache.org> wrote:

> > Make sense.
> > There are second level config for the memory detection. The first level
> is netty jvm param `-Dio.netty.leakDetection.level`, the second level is
> bookkeeper config `AbstractConfiguration#setAllocatorLeakDetectionPolicy`.
> >
> > If the second level be config greater than `Disabled`, the second level
> will override the first level.
> > If the second level is `Disabled`, we use the first level config.
>
> The default detection level in netty is `Simple`, the default detection
> level in bookkeeper is `Disabled`. If the user didn't config the bookkeeper
> level detection policy, it will use netty default detection level
> `Simple`, it's a breaking change.
>
> So I suggest that we introduce a new jvm param
> `preferNettyLeakDetectionPolicy` in bookkeeper, the default value is
> `false`.
>
> If the user config `-DpreferNettyReLeakDetectionPolicy=true`, the
> bookkeeper leak detection policy won't override the netty config. If the ci
> tests, we config `-Dio.netty.leakDetection.level=paranoid
> -DpreferNettyLeakDetectionPolicy=true`, it will use netty leak detection
> level `paranoid`.
>

Reply via email to