Hit the Assert in SimpleLeakAwareByteBuffer.CloseLeak
- Dominant language
- C#
- Stars
- 4.3k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
Run the below code, and you can see an false case of leak is reported.
And an Debug.Assert can be seen when run with Debug builds of DotNetty.
@nayato @StormHub Any idea for this?
I think the `Retain`/`Release` of IByteBuffer is thread-safe(just don't read/write bytebuf concurrently)?
Use the `ExampleHelper` from `Examples.Common`
```cs
internal class Program
{
static Program()
{
Environment.SetEnvironmentVariable("io.netty.leakDetection.targetRecords", "256");
DotNetty.Common.ResourceLeakDetector.Level = DotNetty.Common.ResourceLeakDetector.DetectionLevel.Paranoid;
}
private static void Main()
{
ExampleHelper.SetConsoleLogger();
{
var loop = new SingleThreadEventLoop();
int i = 0;
do
{
var buf0 = ByteBufferUtil.DefaultAllocator.Buffer();
buf0.WriteInt(i);
buf0.WriteInt(i);
++i;
loop.Schedule(state1 =>
{
var buf1 = (IByteBuffer)state1;
buf1.ReadInt();
buf1.Release();
}, buf0.RetainedSlice(), TimeSpan.FromMilliseconds(10));
buf0.Release();
buf0 = null;
Thread.Sleep(10);
}
while (true);
}
}
}
Contributor guide
Assessment
This issue has not been assessed yet.