Typeorm becomes unresponsive when i execute bulk findOne queries in parallel
See original GitHub issueIssue 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:
- Created 5 years ago
- Comments:6 (5 by maintainers)
@havenchyk i got stuck in work and forgot to create a barebones repository. I’ll make it over the weekend.
I have faced same issue on typeorm 0.2.34