Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netty Webclient memory leak in spring boot [duplicate]

Hi all we are seeing app crash under heavy load when we analyze our heap dump major memory is taken by netty below the following leak suspect

218,618,256 bytes (63.15 %) of Java heap is used by 24 instances of io/netty/buffer/PoolArena$HeapArena
 Contains 12 instances of the following leak suspects:
 - byte[] holding 16,777,224 bytes at 0x711b00000
 - byte[] holding 16,777,224 bytes at 0x710a00000
 - byte[] holding 16,777,224 bytes at 0x70ea00000
 - byte[] holding 16,777,224 bytes at 0x708500000
 - byte[] holding 16,777,224 bytes at 0x70d900000
 - byte[] holding 16,777,224 bytes at 0x70c800000
 - byte[] holding 16,777,224 bytes at 0x71ea00000
 - byte[] holding 16,777,224 bytes at 0x716c00000
 - byte[] holding 16,777,224 bytes at 0x715900000
 - byte[] holding 16,777,224 bytes at 0x705c00000
 - byte[] holding 16,777,224 bytes at 0x704b00000
 - io/netty/buffer/PoolChunk holding 33,609,288 bytes at 0x71d476ad8

we are using only 6 instance of webclient why it is showing 12 instance? why it is not releasing memory? can anyone guide us on this.

WebClient request

    public <T> Mono<T> sendGetRequest(String apiBaseUrl, String apiEndpoint, String queryParams, HttpHeaders headers, Class<T> clazz, Map<String, String> params) {
            return webClient.get()
                    .uri(apiBaseUrl + apiEndpoint, params).headers(getHttpHeaders(headers))
                    .retrieve()
                    .bodyToMono(clazz);
        }
like image 599
Nisarg Bhagavantanavar Avatar asked Mar 18 '26 19:03

Nisarg Bhagavantanavar


1 Answers

This memory is allocated by netty and it's not a leak. See similar question: Memory accumulated in netty PoolChunk

like image 54
pixel Avatar answered Mar 21 '26 15:03

pixel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!