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.

Typeorm becomes unresponsive when i execute bulk findOne queries in parallel

See original GitHub issue

Issue type:

[ ] question [x] bug report [ ] feature request [ ] documentation issue

Database system/driver:

[ ] cordova [ ] mongodb [ ] mssql [ ] mysql / mariadb [ ] oracle [x] postgres [ ] sqlite [ ] sqljs [ ] react-native [ ] expo

TypeORM version:

[ ] latest [x] @next [ ] 0.x.x (or put your version here)

Steps to reproduce or a small repository showing the problem:

Hi,

I have the following function that i am calling 100 times in parallel:

export const findByCityNameAndStateId = async (cityName: string, stateId: number):
  Promise<City | undefined> => {
  return getRepository(City).findOne({
    where: {
      value: cityName,
      state: {
        id: stateId
      }
    },
    relations: ['state']
  });
};

The problem is that Typeorm starts to behave erratically when i execute this method in parallel a 100 times and does not return. And i have noticed this behavior on and off in alot of other methods. I even tried replacing findOne with find and a query builder but the same problem existed.

The problem went away when i reduced the number of parallel executions from 100 to 10.

My question is that am i doing something wrong here or does this problem exist in Typeorm?

Looking forward to hearing on this!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
HussainAliAkbarcommented, Nov 26, 2018

@havenchyk i got stuck in work and forgot to create a barebones repository. I’ll make it over the weekend.

0reactions
sahebtecommented, Oct 6, 2022

I have faced same issue on typeorm 0.2.34

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeORM- findOne returns unexpected value
When you refer to email in your findOne query, TypeOrm is unable to identify which column you are referring too. This code should...
Read more >
Typeorm how to use relations in findOne()-postgresql
Coding example for the question Typeorm how to use relations in findOne()-postgresql.
Read more >
Transactions - typeorm - GitBook
Using QueryRunner to create and control state of single database connection. There are 3 methods to control transactions in QueryRunner : startTransaction - ......
Read more >
MongoDB | TypeORM Docs
Perform a bulkWrite operation without a fluent API. # count. Count number of matching documents in the db to a query. # createCollectionIndex....
Read more >
“typeorm find join example” Code Answer
Queries related to “typeorm find join example” ... The file C:\Users\nEW u\AppData\Roaming\npm\ng.ps1 is setting execution policy, ...
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