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 when using getOne in queryBuilder

See original GitHub issue

Issue Description

I want to get the latest item with updatedAt sort by DESC. Im use the code like this:

this.customerRepository.createQueryBuilder().sort('updatedAt', 'DESC').getOne();

Expected Behavior

No memory leak.

Actual Behavior

I watch Monitor (on MacOS) and Memory of my application grow so fast. From 300MB to 1.5GB, sometime it grow to ~2GB.

// include the output in code tags like these!

Steps to Reproduce

  1. Refactor the code using .getOne() in chain and observer the result of memory.
// insert code here

My Environment

Dependency Version
Operating System MacOS
Node.js version v12.22.7
Typescript version 4.2.3
TypeORM version 0.2.40

Additional Context

Relevant Database Driver(s)

DB Type Reproducible
aurora-data-api no
aurora-data-api-pg no
better-sqlite3 no
cockroachdb no
cordova no
expo no
mongodb no
mysql yes
nativescript no
oracle no
postgres no
react-native no
sap no
sqlite no
sqlite-abstract no
sqljs no
sqlserver no

Are you willing to resolve this issue by submitting a Pull Request?

  • ✖️ Yes, I have the time, and I know how to start.
  • ✖️ Yes, I have the time, but I don’t know how to start. I would need guidance.
  • ✖️ No, I don’t have the time, but I can support (using donations) development.
  • ✅ No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
Gindencommented, Jan 26, 2022

Can you provide reproduction repository?

0reactions
stewartmcgowncommented, Mar 31, 2022

I have no specific cause ironed out yet, but I’ve just migrated from the v0.3.0-RC branch to 0.3.4 and I’m seeing constant GC failures and crashes.

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeORM- findOne returns unexpected value - Stack Overflow
When I use TypeORM's findOne function to search for a Email which doesn't exist in the database, findOne returns the first entry to...
Read more >
Improving Performance - Doctrine Object Relational Mapper ...
If entities hold references to large collections you will get performance and memory problems initializing them. To solve this issue you can use...
Read more >
Making queries | Django documentation
To create an object, instantiate it using keyword arguments to the model ... This means things should work intuitively, so the abstraction doesn't...
Read more >
Elastic-apm-node memory leak
Ever since I incorporated APM (elastic-apm-node) in some nodejs microservices they have developed memory leaks.
Read more >
Test Driven Development with Node, Postgres, and Knex (Red ...
Knex is a SQL query builder that we can use with PostgreSQL to ... error handler // no stacktraces leaked to user app.use(function(err,...
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