Skip to content

Integrate tracer to detect memory leaks #151

Open
@aryanjassal

Description

@aryanjassal

Specification

For almost a year now, the Polykey seednodes have had a memory leak. This can be observed at https://mainnet.polykey.com, where the memory consumption can be seen to spike, then the node fails and the container is restarted.

This leak does not happen on https://testnet.polykey.com which, at the moment, does not have any nodes directly connecting to it. This means that the memory leak happens due to leaks in the connection process.

@tegefaulkes ran a script which opened a connection and created and immediately destroyed tens of thousands of streams. He observed a noticable increase in memory consumption, when the whole operation should have net zero memory change. Going over the javascript code does not reveal anything obvious, so this issue is likely to lie in the native layer.

The role of tracer will be to track events and lifecycles of other objects during the test to narrow down on the precise layer where we have leaks. Our current theory is that quiche might itself have a memory leak, but this effort will be to confirm the source and attempt a fix.

Additional context

Tasks

  1. Integrate tracing from js-logger
  2. Apply to object lifecycles and functions where possible
  3. Run tests to run the code and confirm tracer can output valid data
  4. Run the repeat stream test to trace the memory leak

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions