Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction(s) stuck after connection limit reached #115

Open
st1906 opened this issue Feb 5, 2023 · 0 comments
Open

Transaction(s) stuck after connection limit reached #115

st1906 opened this issue Feb 5, 2023 · 0 comments

Comments

@st1906
Copy link

st1906 commented Feb 5, 2023

Hi, lets say we have the following

@transactional(PROPAGATION.REQUIRED)
create(){
 // insert something to DB
}

And the max connection limit set in typeorm is reached (lets say 2)

calling the method twice like this

await Promise.all([myService.create(), myService.create()])

produces the following logs and makes the service unable to do any additional queries to the DB.

Transactional@1675616291035|default|create|undefined|REQUIRED - Before starting: isCurrentTransactionActive = undefined
Transactional@1675616291037|default|create|undefined|REQUIRED - Before starting: isCurrentTransactionActive = undefined
query: START TRANSACTION
Transactional@1675616291035|default|create|undefined|REQUIRED - runWithNewTransaction - set entityManager in context: isCurrentTransactionActive: true
query: START TRANSACTION
Transactional@1675616291037|default|create|undefined|REQUIRED - runWithNewTransaction - set entityManager in context: isCurrentTransactionActive: true

It looks like when the pool size is reached, the methods try to create transactions and lock each other(?). Setting the PROPAGATION to mandatory makes it work. If anyone has a better understanding what is happening (and if this is expected behavior?), would appreciate an answer. (Same issue can be reproduced if the connection limit is raised at 5 or 10, and 5 or 10 calls are made)

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant