Memory leak with query (secondary index)
See original GitHub issueTest Environment Node: 12.14.1 Aerospike Client: 3.16.0 Aerospike Server: 4.8.0.5
We are seeing a case where our process memory keeps on increasing slowly till it reaches the limit (~1 GB) and restarts. The process mainly uses the Aerospike query at ~200 requests per second.
I have created a sample project in GitHub with the scripts.
To run the scripts:
- yarn run build (or “yarn install” or “npm install”)
- NAMESPACE=my_ns node aerospike-basic-secondary.js > /tmp/secondary.log & NAMESPACE=my_ns node aerospike-basic-primary.js > /tmp/primary.log &
The memory usage for the primary stays almost the same:
2020-06-23T07:46:42.309Z - Stats - requestsPerSecond 820.02, total: 664219, memoryUsage: {"rss":42418176,"heapTotal":9641984,"heapUsed":4265424,"external":870289} 2020-06-23T08:05:42.313Z - Stats - requestsPerSecond 820.12, total: 1599247, memoryUsage: {"rss":46743552,"heapTotal":13836288,"heapUsed":4176200,"external":877881} 2020-06-23T08:26:12.316Z - Stats - requestsPerSecond 820.16, total: 2608103, memoryUsage: {"rss":46743552,"heapTotal":13836288,"heapUsed":7477368,"external":906033} 2020-06-23T08:55:12.321Z - Stats - requestsPerSecond 820.21, total: 4035442, memoryUsage: {"rss":46743552,"heapTotal":13836288,"heapUsed":5395056,"external":901545} 2020-06-23T09:40:12.339Z - Stats - requestsPerSecond 820.21, total: 6250066, memoryUsage: {"rss":55603200,"heapTotal":22224896,"heapUsed":7497416,"external":930369}
However, the memory usage for the secondary increases over time:
2020-06-23T07:34:54.988Z - Stats - requestsPerSecond 894.26, total: 80489, memoryUsage: {"rss":52752384,"heapTotal":14622720,"heapUsed":7615648,"external":879211} 2020-06-23T07:58:54.990Z - Stats - requestsPerSecond 896.78, total: 1372083, memoryUsage: {"rss":139362304,"heapTotal":14622720,"heapUsed":9085856,"external":893903} 2020-06-23T08:56:24.998Z - Stats - requestsPerSecond 896.75, total: 4465818, memoryUsage: {"rss":355201024,"heapTotal":23011328,"heapUsed":12752792,"external":926627} 2020-06-23T09:32:25.001Z - Stats - requestsPerSecond 896.92, total: 6404059, memoryUsage: {"rss":485105664,"heapTotal":23011328,"heapUsed":10777704,"external":934011} 2020-06-23T09:43:25.003Z - Stats - requestsPerSecond 896.99, total: 6996546, memoryUsage: {"rss":524931072,"heapTotal":23011328,"heapUsed":10265528,"external":931811}
Initially, my secondary script had promise and had some logic to return the values and it was still leaking. Therefore, I simplified it using the Aerospike example.
Please let me know if you see any issues with my scripts or if you need any info from me.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)

Top Related StackOverflow Question
I have published v3.16.1 to npmjs.com just now.
Great! Thanks for helping to test this. I should be able to do a release early next week; possibly even tomorrow, if I can find the time.