Skip to content

Potential memory leak in PostgreSQL telemetry #1415

@markkurikola-luoto

Description

@markkurikola-luoto

Disclaimer: I apologize that this is more vague and inconclusive than I'd like. As such, I'm posting it more as a heads up than a proper bug report.

My team has been using v3.4.0 of the applicationinsights library in our project. Recently we noticed signs of a memory leak, and with heap snapshots, managed to pinpoint it to PostgreSQL connections (and all the buffers, sockets etc. related to said connections) remaining in memory, as well as some Application insights telemetry calls. Putting 1+1 together, we disabled Application insights, and lo and behold, the memory leak also disappeared. Relevant parts of our stack are as follows:

  • node.js v20.17.0
  • @nestjs/core 10.4.15
  • @nestjs/typeorm 10.0.2
  • pg 8.13.1
  • typeorm 0.3.20

Now, this is the part where I'd like to be able to point to a minimal reproduction of the problem, but unfortunately I failed to reproduce the error in any minimal setup I attempted. I also can't link to the real repository for obvious security reasons. As a result, I believe that there's something more complicated going on, given that using the @azure/monitor-opentelemetry library directly has not produced a similar memory leak. But those complications are unfortunately above my pay grade, so here we are.

Any questions to clarify the situation are welcome, and I'm happy to assist if I can.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions