python-socketio
python-socketio copied to clipboard
Memory Usage Increases heavily on packet sending

After using guppy to profile heap usage i found that most of the memory which is not freed are instances of engineio.packet.Packet
from guppy import hpy
hp = hpy()
after= hp.heap()
(Pdb) after
Partition of a set of 238362 objects. Total size = 399495864 bytes.
Index Count % Size % Cumulative % Kind (class / dict of class)
0 4077 2 369537464 93 369537464 93 unicode
1 90861 38 9798800 2 379336264 95 str
2 51605 22 5016536 1 384352800 96 tuple
3 784 0 2264704 1 386617504 97 dict of module
4 13381 6 1712768 0 388330272 97 types.CodeType
5 875 0 1681928 0 390012200 98 dict (no owner)
6 1763 1 1599856 0 391612056 98 type
7 1763 1 1583432 0 393195488 98 dict of type
8 13164 6 1579680 0 394775168 99 function
9 35057 15 841368 0 395616536 99 int
(Pdb) after.byrcs[0]
Partition of a set of 2373 objects. Total size = 368690936 bytes.
Index Count % Size % Cumulative % Referrers by Kind (class / dict of class)
0 2373 100 368690936 100 368690936 100 dict of engineio.packet.Packet
(Pdb) i = iter(after.byrcs[0].nodes)
(Pdb) i.next()
Shows data of the packets which were sent by the server
What could be the problem ?
Could this happen if the clients are slow in receiving the packets ?
What did your server and client do while these measurements were taken? Any code you can share to help me reproduce here?
notice the same behaviour
using python==3.7.2 tornado==5.1.1, redis manager
it increases after a js client disconnect (meanwhile a python write only client keep generating data from server)
I suspect that would be the AsyncRedisManager, seems it lacks a proper closing method
This is extremely old, and memory leak bugs have been addressed since then, so I assume it is fixed.