Remove duplicated DataBuffer that caused leak alert by LocalResponseCache (#2886)
Having `response.bufferFactory().wrap(byteBuffer)` left the original DataBuffer without calling internally the `release()` method, which also decrease the counter of the incoming references to the object by Netty memory leak control. This copy is not necessary and it was making Netty losing the object, causing memory Leak alert [connected #2879]
This commit is contained in:
@@ -98,7 +98,7 @@ public class ResponseCacheManager {
|
||||
return body.map(dataBuffer -> {
|
||||
ByteBuffer byteBuffer = dataBuffer.toByteBuffer().asReadOnlyBuffer();
|
||||
cachedResponseBuilder.appendToBody(byteBuffer);
|
||||
return response.bufferFactory().wrap(byteBuffer);
|
||||
return dataBuffer;
|
||||
}).doOnComplete(() -> {
|
||||
CachedResponse responseToCache = cachedResponseBuilder.timestamp(toProcess.timestamp()).build();
|
||||
saveMetadataInCache(metadataKey, metadata);
|
||||
|
||||
Reference in New Issue
Block a user