eu-federation-gateway-service / efgs-federation-gateway

The goal of this project is to develop the official European solution for the interoperability between national backend servers of decentralised contact tracing applications to combat COVID-19.
Apache License 2.0
59 stars 25 forks source link

Callback request causes Memory Leak Warning #247

Closed f11h closed 3 years ago

f11h commented 3 years ago

Describe the bug

We experienced that the CallbackTaskExecuter can cause some log messages that some ByteBuffers are not read before they are collected by GC. This bug is a infrequent bug.

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.netty.buffer.PooledByteBufAllocator.newDirectBuffer(PooledByteBufAllocator.java:385), 
io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:187), 
io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:178), 
io.netty.buffer.AbstractByteBufAllocator.buffer(AbstractByteBufAllocator.java:115), 
io.netty.handler.ssl.SslHandler.allocate(SslHandler.java:2198), io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1375), 
io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1275), 
io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1322), 
io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501), 
io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:440), 
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276),
...

Expected behaviour

CallbackRequests should be sent without any error messages.

Steps to reproduce the issue

  1. Subscribe for Callback
  2. Upload Keys
  3. Wait for Batching
  4. Wait for Callback processing

Possible Fix

A possible fix could be to replace the .exchange() call with .retrieve() at WebClient. Because the exchange-call will nopt read the data buffer and this could cause that the data buffers getting overloaded.

Additional context

As long as this bug cannot be reliably reproduced we cannot verify that it is finally fixed.