Potential memory leak in flask_restful.reqparse ???
Hello Community,
I am facing memory leak issues for my app on production which is based on flask(with flask_restful) served on gunicorn in GKE cluster. The memory consumed by the gunicorn workers are increasing with the no of requests. Ideally, after serving the requests, it should come down to normal value but don't. So, for memory profiling I am using guppy3 module. In the profiling logs, I can see something related to flask_restful.reqparse.Arguments dictionary[as shown below].
Can someone please confirm if it is a memory leak in flask_resful package or it's a false positive type datapoint?
Index Count % Size % Cumulative % Kind (class / dict of class)
0 996 0 65265112 25 65265112 25 bytearray
1 1036 0 34200608 13 99465720 38 set
2 1092298 53 30632428 12 130098148 49 int
3 226672 11 22550200 9 152648348 58 str
4 46241 2 22130112 8 174778460 66 types.FrameType
5 66816 3 15079512 6 189857972 72 dict (no owner)
6 123981 6 8656568 3 198514540 76 tuple
_**7 32144 2 7457408 3 205971948 78 dict of flask_restful.reqparse.Argument**_
8 6297 0 6502768 2 212474716 81 type
9 27177 1 4953176 2 217427892 83 types.CodeTypeGunicorn configuration:
workers = 7
max_requests = 50000
worker_class = "gevent"Python version = 3.9.13 flask = 1.1.4 werkzueg = 1.0.1 flask_restful = latest
Source: flask-restful/flask-restful