question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Memory leak with query (secondary index)

See original GitHub issue

Test 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:

  1. yarn run build (or “yarn install” or “npm install”)
  2. 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:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jheckingcommented, Jun 30, 2020

I have published v3.16.1 to npmjs.com just now.

1reaction
jheckingcommented, Jun 25, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Memory leak during repeated lucene query searches?
Basically, I simply want to do many searches on a given lucene index. Therefore, I made a class Data with final 'analyzer', 'reader',...
Read more >
Problems with Secondary Indexes and Garbage Collection
There is an issue in memory usage for secondary indexes with namespaces that use a storage device. If, between garbage collection passes, ...
Read more >
Best practices for using secondary indexes in DynamoDB
Secondary indexes are often essential to support the query patterns that your application requires. At the same time, overusing secondary indexes or using...
Read more >
#577 (possible memory leak with buffer()) – PostGIS
The modified query ran for 23 minutes and used about 600mb of memory. ... Forthly do you have spatial indexes in place as...
Read more >
FIX: A memory leak occurs when SQL Server procedure cache ...
If the SQL Server procedure cache consumes too much memory that has several entries in it, and the Query Store is enabled, a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found