Skip to content

Investigate memory leaks in code and tests #542

@tegefaulkes

Description

@tegefaulkes

Specification

During #534 we discovered some potential memory leaks. The Ci job for the tests/client domain was running out of memory and core dumping. There seems to be a problem here.

Running the client domain tests with npm run test -- --runInBand --logHeapUsage tests/client shows a steady increase of heap usage between tests totalling 1.2GB of heap used by the end.

A stopgap measure has been taken by running jest with the node option --expose-cg allowing jest to trigger garbage collection between tests. 52 test files have been combined into 7 files, one for each domain. This is enough to solve the problem for now.

Given that reducing the number of files significantly reduced the memory usage, this suggests that the main memory leak is related to the global scope and imports in some fashion.

Further work needs to be done to discover these leaks and resolve them.

Additional context

Tasks

  1. Investigate the source of the leaks.
  2. Do A|B testing per domain to determine where the majority of the memory is being used

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions