question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ByteBuf.release() was not called before it's garbage-collected

See original GitHub issue

Micrometer version: 1.1.2

Publishing metrics with statsD micrometer occasionally throws the following exception:

i.m.s.i.n.u.ResourceLeakDetector: LEAK: ByteBuf.release() was not called before it's garbage-collected. See https://netty.io/wiki/reference-counted-objects.html for more information.
Recent access records: 
Created at:
    io.micrometer.shaded.io.netty.buffer.PooledByteBufAllocator.newDirectBuffer(PooledByteBufAllocator.java:349)
    io.micrometer.shaded.io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:187)
    io.micrometer.shaded.io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:173)
    io.micrometer.shaded.io.netty.buffer.AbstractByteBufAllocator.buffer(AbstractByteBufAllocator.java:107)
    io.micrometer.shaded.reactor.netty.NettyOutbound.lambda$sendString$5(NettyOutbound.java:300)
    io.micrometer.shaded.reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:100)
    io.micrometer.shaded.reactor.core.publisher.FluxOnBackpressureLatest$LatestSubscriber.drain(FluxOnBackpressureLatest.java:176)
    io.micrometer.shaded.reactor.core.publisher.FluxOnBackpressureLatest$LatestSubscriber.onNext(FluxOnBackpressureLatest.java:127)
    io.micrometer.shaded.reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:114)
    io.micrometer.shaded.reactor.core.publisher.FluxBufferPredicate$BufferPredicateSubscriber.onNextNewBuffer(FluxBufferPredicate.java:277)
    io.micrometer.shaded.reactor.core.publisher.FluxBufferPredicate$BufferPredicateSubscriber.tryOnNext(FluxBufferPredicate.java:224)
    io.micrometer.shaded.reactor.core.publisher.FluxBufferPredicate$BufferPredicateSubscriber.onNext(FluxBufferPredicate.java:194)
    io.micrometer.shaded.reactor.core.publisher.FluxFlatMap$FlatMapMain.tryEmit(FluxFlatMap.java:530)
    io.micrometer.shaded.reactor.core.publisher.FluxFlatMap$FlatMapInner.onNext(FluxFlatMap.java:972)
    io.micrometer.shaded.reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:192)
    io.micrometer.shaded.reactor.core.publisher.DirectProcessor$DirectInner.onNext(DirectProcessor.java:333)
    io.micrometer.shaded.reactor.core.publisher.DirectProcessor.onNext(DirectProcessor.java:142)
    io.micrometer.shaded.reactor.core.publisher.FluxCreate$IgnoreSink.next(FluxCreate.java:618)
    io.micrometer.shaded.reactor.core.publisher.FluxCreate$SerializedSink.next(FluxCreate.java:153)
    io.micrometer.statsd.StatsdDistributionSummary.recordNonNegative(StatsdDistributionSummary.java:52)
    io.micrometer.core.instrument.AbstractDistributionSummary.record(AbstractDistributionSummary.java:49)
    io.micrometer.core.instrument.composite.CompositeDistributionSummary.lambda$record$0(CompositeDistributionSummary.java:38)
    java.base/java.lang.Iterable.forEach(Iterable.java:75)
    io.micrometer.core.instrument.composite.AbstractCompositeMeter.forEachChild(AbstractCompositeMeter.java:47)
    io.micrometer.core.instrument.composite.CompositeDistributionSummary.record(CompositeDistributionSummary.java:38)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:23 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kdamevincommented, Jul 24, 2020

Getting the issue as well with micrometer 1.5.2. However we encountered another issue in 1.5.1 with duplicate metrics being sent (https://github.com/micrometer-metrics/micrometer/issues/2138) so not easy for us to downgrade. Not sure what’s better 😓

1reaction
cicilthomascommented, Jun 22, 2020

Started experiencing the same issue after upgrading to springboot 2.3.1.RELEASE and micrometer 1.5.1 @shakuzen for me this can be reproduced by just running the springboot app and doing nothing. This error will be thrown after sometime (˜10-15 mins)

Read more comments on GitHub >

github_iconTop Results From Across the Web

LEAK: ByteBuf.release() was not called before it's garbage ...
You need to call release on the ByteBuf rather than clear in your finally block, otherwise the reference counted buffer is not de-allocated...
Read more >
LEAK: ByteBuf.release() was not called before it's garbage ...
Expected behavior No leak Actual behavior LEAK: ByteBuf.release() ... LEAK: ByteBuf.release() was not called before it's garbage-collected.
Read more >
LEAK: ByteBuf.release() was not called before it's garbage ...
After some time collecting data from a modbus TCP device we get the error: 16:29:50.228 ERROR ResourceLeakDetector: LEAK: ByteBuf.release() ...
Read more >
LEAK: ByteBuf.release() was not called before it's garbage ...
I have a single-type es node , the es node is runing by docker ... LEAK: ByteBuf.release() was not called before it's garbage-collected....
Read more >
ByteBuf.release() was not called before it's garbage-collected
ResourceLeakDetector - LEAK: ByteBuf.release() was not called before it's garbage-collected. Recent access records: 1 #1: io.netty.buffer.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found