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.

Memory leak in IdleConnectionWatcher

See original GitHub issue

Hey,

I have a production environment which uses a load balancer over several master Redis instances, so the actual IPs of the Redis instances switch with every request.

I update Redisson from some 3.3.* version to 3.15.3 and started to notice odd memory consumption: something keeps piling up in the Old Generation and never gets garbage-collected. Normally, it would take about a day to reach Old Gen mem cap and in a few days, so when other objects make it to Old Gen, the app just dies with OOM.

I dumped the memory, it looks like when IPs change, new ClientConnectionsEntry items are allocated and attached the linked queue in the IdleConnectionWatcher which is never pruned, unless the client is shut down. I can’t tell how many nodes are in those queues, probably too many, because IdleConnectionWatcher is about 30Mb big.

Unfortunately, I cannot change the infrastructure I use. Any chance there’s any config that could just mitigate it for now?

Expected behavior Application does not run out of memory if connection entries are re-created frequently and dangling objects are cleaned up.

Actual behavior Strong references to previously created objects are retained and keep piling up until the app gets OOM-killed.

Steps to reproduce or test case Tricky: Redis instances should be behind a load balancer, which should have a resolvable hostname. The idea is to make Redisson try to rebuild the connection pool every time it makes a request.

Redis version Idk, because I don’t have access to the infrastructure.

Redisson version 3.15.3

Redisson configuration

  1. Clients connect to Master nodes.
  2. Clients are single-threaded.
  3. Clients attempt to resolve hostname to connect to actual Redis instances.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mrnikocommented, May 11, 2021
0reactions
artkonrcommented, May 11, 2021

Awesome, thanks! I wonder if there is a snapshot artifact I could try out, there some style check failing on master, I can’t build it myself.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Detect Memory Leaks in Java: Causes, Types, & Tools
A memory leak is a situation where unused objects occupy unnecessary space in memory. Unused objects are typically removed by the Java ...
Read more >
Finding Memory Leaks - Apple Developer
Memory leaks are blocks of allocated memory that the program no longer references. Leaks waste space by filling up pages of memory with ......
Read more >
Understanding Memory Leaks in Java - Baeldung
A Memory Leak is a situation where there are objects present in the heap that are no longer used, but the garbage collector...
Read more >
Causes of Memory Leaks in JavaScript and How to Avoid Them
In this article, we will explore programming patterns that cause memory leaks in JavaScript and explain how to improve memory management.
Read more >
Finding memory leaks using Timing Captures - PIX on Windows
To enable the leak tracking features, select one or both of the memory tracking options when starting a Timing Capture. Image mem leaks...
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