Hi!
Problem with memory leak on grpcio after 1.48.1 persistent.
OS - Ubuntu 22.04, The blue and green line it is martin-binance 1.3.4 prod instance, where grpcio==1.48.1. It is stable. For yellow instance I try upgrade grpcio to 1.57.0 and get problem with memory.
And it is not in Python code:
```
```
```
[2023-08-31 13:13:17,863: INFO] Partition of a set of 374326 objects. Total size = 45706311 bytes.
Index Count % Size % Cumulative % Kind (class / dict of class)
0 48350 13 14826776 32 14826776 32 dict (no owner)
1 172365 46 12183673 27 27010449 59 str
2 41081 11 2909376 6 29919825 65 tuple
3 10939 3 2108276 5 32028101 70 types.CodeType
4 1840 0 1709432 4 33737533 74 type
5 19872 5 1676867 4 35414400 77 bytes
6 10684 3 1538496 3 36952896 81 function
7 14518 4 1477488 3 38430384 84 list
8 1840 0 926008 2 39356392 86 dict of type
9 453 0 708800 2 40065192 88 dict of module
<641 more rows. Type e.g. '_.more' to view.>
```
and
```
def pstats():
process = psutil.Process(os.getpid())
logger.info(
{"rss": f"{process.memory_info().rss / 1024 ** 2:.2f} MiB",
"vms": f"{process.memory_info().vms / 1024 ** 2:.2f} MiB",
"shared": f"{process.memory_info().shared / 1024 ** 2:.2f} MiB",
"open file descriptors": process.num_fds(),
"threads": process.num_threads()}
)
```
return
```
[2023-08-31 13:13:17,865: INFO] {'rss': '1208.87 MiB', 'vms': '2553.13 MiB', 'shared': '23.82 MiB', 'open file descriptors': 135, 'threads': 12}
```
After I try use `valgring` and get:
```
==1318226== 7,374,928 bytes in 11 blocks are possibly lost in loss record 1,264 of 1,264
==1318226== at 0x48487A9: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==1318226== by 0x83FF781: _upb_Arena_SlowMalloc (in /home/ubuntu/.local/lib/python3.10/site-packages/google/_upb/_
message.abi3.so)
==1318226== by 0x83D9F33: PyUpb_PyToUpb (in /home/ubuntu/.local/lib/python3.10/site-packages/google/_upb/_
message.abi3.so)
==1318226== by 0x83E4CC4: PyUpb_RepeatedScalarContainer_Append (in /home/ubuntu/.local/lib/python3.10/site-packages/google/_upb/_
message.abi3.so)
==1318226== by 0x273F89: ??? (in /usr/bin/python3.10)
==1318226== by 0x250F51: _PyEval_EvalFrameDefault (in /usr/bin/python3.10)
==1318226== by 0x28587F: ??? (in /usr/bin/python3.10)
==1318226== by 0x36213E: ??? (in /usr/bin/python3.10)
==1318226== by 0x4036FA: ??? (in /usr/bin/python3.10)
==1318226== by 0x7684DD8: ??? (in /home/ubuntu/.local/lib/python3.10/site-packages/grpc/_cython/
cygrpc.cpython-310-x86_64-linux-gnu.so)
==1318226== by 0x7684DA7: ??? (in /home/ubuntu/.local/lib/python3.10/site-packages/grpc/_cython/
cygrpc.cpython-310-x86_64-linux-gnu.so)
==1318226== by 0x7684DA7: ??? (in /home/ubuntu/.local/lib/python3.10/site-packages/grpc/_cython/
cygrpc.cpython-310-x86_64-linux-gnu.so)
==1318226==
==1318226== LEAK SUMMARY:
==1318226== definitely lost: 2,000 bytes in 23 blocks
==1318226== indirectly lost: 5,440 bytes in 17 blocks
==1318226== possibly lost: 19,236,245 bytes in 428 blocks
==1318226== still reachable: 6,232,524 bytes in 11,413 blocks
==1318226== of which reachable via heuristic:
==1318226== stdstring : 3,949 bytes in 72 blocks
==1318226== newarray : 1,416 bytes in 1 blocks
==1318226== suppressed: 0 bytes in 0 blocks
==1318226== Reachable blocks (those to which a pointer was found) are not shown.
==1318226== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==1318226==
==1318226== For lists of detected and suppressed errors, rerun with: -s
==1318226== ERROR SUMMARY: 155 errors from 155 contexts (suppressed: 0 from 0)
```
In order to get a more specific result, I need to use the grpcio assembly with the debug switch -g
I am trying to figure out how to do this. This is not my area, maybe you can tell me how to move on.
Regard's, Jerry.
среда, 19 июля 2023 г. в 12:14:30 UTC+3, Jerry: