Skip to content

[BUG] memory leak after overload or timeout #630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
amosyxy opened this issue Mar 19, 2025 · 9 comments
Closed

[BUG] memory leak after overload or timeout #630

amosyxy opened this issue Mar 19, 2025 · 9 comments

Comments

@amosyxy
Copy link

amosyxy commented Mar 19, 2025

Describe the bug
memory leak
3 master and 3 slave

To Reproduce
do robuness test
using api AsyncRedisCluster to send set, get, delete to redis server with 1000000 keys and each the value has 10k len and each key 100 len
please send the traffic at high speed util get error includint timeout error and overload
and memory of client app will increase more and more over 5G or more
and then decrease the traffic to very very low speed
and continue observer the RES memory of client app by top command
even the traffic is very small, but the memory still not decreased for the whole night in idle

Expected behavior
we expect the memory should go backto normal

Environment:

OS:
gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu224.04)
root@iZuf6gqbr8mboxi4muxirlZ:/redis/redis-plus-plus/build#
root@iZuf6gqbr8mboxi4muxirlZ:~/redis/hiredis# git branch
(HEAD detached at v1.2.0)

root@iZuf6gqbr8mboxi4muxirlZ:~/redis/redis-plus-plus# git branch
(HEAD detached at 1.3.13)
@amosyxy
Copy link
Author

amosyxy commented Mar 19, 2025

please apply this fixing #625
and then do this new overload test

@amosyxy
Copy link
Author

amosyxy commented Mar 19, 2025

redis_client.tar.gz

@amosyxy
Copy link
Author

amosyxy commented Mar 19, 2025

client
./redis_benchmark --host=127.0.0.1 --port=7000 --threads=4 --requests=100000 --datasize=1024 --command=set,get,del --loops=100000

login debug command line and set rate per second and start test
telnet 127.0.0.1 5000
rate 100000
start

uttil over load
then
rate 10

memory should decrease

@amosyxy
Copy link
Author

amosyxy commented Mar 19, 2025

try your best send more and more traffic at hight speed util over and timeout
even redis-server over load

then switch traffic speed to low or normal,
app client memory shoud decreased to normal

@amosyxy
Copy link
Author

amosyxy commented Mar 19, 2025

who can help fix memory leak issue
all AsyncConnection can be released normal
i adoult that the leak in hiredis lib when overload happened in client side and server side

@amosyxy
Copy link
Author

amosyxy commented Mar 19, 2025

please note:
OS:
gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu224.04)
hiredis at v1.2.0
redis-plus-plus at 1.3.13

@amosyxy
Copy link
Author

amosyxy commented Mar 19, 2025

any one can help this. thanks a lot.

@sewenew
Copy link
Owner

sewenew commented Mar 19, 2025

This looks like not a memory leak. When the process frees/deletes memory, it does not return the memory to operation system. That's why when you decrease the traffic, the memory does not decreased. Check this for detail.

If you still have doubt with it, you can run your benchmark test with valgrind to see if there's memory leak:

valgrind --leak-check=full \
         --show-leak-kinds=all \
         --track-origins=yes \
         --verbose \
         --log-file=valgrind-out.txt \
         ./redis_benchmark --host=127.0.0.1 --port=7000 --threads=4 --requests=100000 --datasize=1024 --command=set,get,del --loops=100000

Regards

@amosyxy
Copy link
Author

amosyxy commented Mar 20, 2025

after using valgrind, no memory leak
yes the memory is not released to OS, it is not memory leak
after i invoke malloc_trim(0), all memory release to normal status
thanks for your support

@amosyxy amosyxy closed this as completed Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants