You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using transactions (connected to a Postgres database) and after I call commit() or rollback() on them, their connections are left open, causing a sorry, too many clients already error to happen later on in my application when I try to start more transactions.
Output from SELECT * FROM pg_stat_activity; after a transaction has run and completed:
We've seen this in production, they are in fact closed, but not untill the idle timeout is reached. Connections should probably be explicitely closed on commit/rollback.
@programble if you can provide a PR with a unit test that would be neat (would also speed up getting a fix in)
Hi,
Same for me. After commit or rollback transaction i need to wait few seconds to close connection.
Sometimes... in "query" column(from SELECT * FROM pg_stat_activity;) is not the "COMMIT" but some select or insert from inside of transaction.
For example SELECT * from "Reports" where "Reports"."id" = 1474 LIMIT 1
Please can you help? Thank you
Hi @mickhansen, I also have the problem, I tried to reproduce the error with a test
Uncaught error: sorry, too many clients already maximeCony@09bb5fa
I hope this will help you.
@alexnaspo Not with a decent amount of concurrency going on. Transactions need to be refactored to use connection pools. Hopefully we will get a fix in soon.
Edit: But i suppose it depends on when you plan to hit production.
@mickhansen I had to remove transactions from my project. I will reimplement them as soon as I am upgrading Sequelize (currently on 2.0.0-dev10)
I'll let you know.
Thanks a lot!
Error: ConnectionManager.getConnection was called after the connection manager was closed!
server | at ConnectionManager.getConnection (/app/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:70:13)
server | at /app/node_modules/sequelize/lib/sequelize.js:305:111
server | at /app/node_modules/retry-as-promised/dist/index.js:59:25
server | at new Promise (<anonymous>)
server | at retryAsPromised (/app/node_modules/retry-as-promised/dist/index.js:48:12)
server | at Sequelize.query (/app/node_modules/sequelize/lib/sequelize.js:300:12)
server | at MySQLQueryInterface.select (/app/node_modules/sequelize/lib/dialects/abstract/query-interface.js:407:33)
server | at Function.findAll (/app/node_modules/sequelize/lib/model.js:1140:47)
server | at processTicksAndRejections (internal/process/task_queues.js:95:5)
server | at async Function.findOne (/app/node_modules/sequelize/lib/model.js:1240:12)
Activity
mickhansen commentedon Apr 7, 2014
We've seen this in production, they are in fact closed, but not untill the idle timeout is reached. Connections should probably be explicitely closed on commit/rollback.
@programble if you can provide a PR with a unit test that would be neat (would also speed up getting a fix in)
miklacko commentedon Apr 7, 2014
Hi,
Same for me. After commit or rollback transaction i need to wait few seconds to close connection.
Sometimes... in "query" column(from SELECT * FROM pg_stat_activity;) is not the "COMMIT" but some select or insert from inside of transaction.
For example SELECT * from "Reports" where "Reports"."id" = 1474 LIMIT 1
Please can you help? Thank you
mickhansen commentedon Apr 8, 2014
@miklacko i'll refer you to the comment i wrote.
maximeCony commentedon Apr 14, 2014
Hi @mickhansen, I also have the problem, I tried to reproduce the error with a test
Uncaught error: sorry, too many clients already
maximeCony@09bb5fa
I hope this will help you.
mickhansen commentedon Apr 15, 2014
@maximeCony unit tests always helps me - I'll take a look, or perhaps @sdepold can?
sdepold commentedon Apr 15, 2014
will check that later the day
alexnaspo commentedon Apr 23, 2014
+1
I am having this error as well. Can I rely on transactions at this stage in development for production purposes?
mickhansen commentedon Apr 23, 2014
@alexnaspo Not with a decent amount of concurrency going on. Transactions need to be refactored to use connection pools. Hopefully we will get a fix in soon.
Edit: But i suppose it depends on when you plan to hit production.
nisnardi commentedon Apr 23, 2014
+1 I have the same problem.
miklacko commentedon Jun 10, 2014
Hi is something new about this issue?? I still having problems to use transactions because they are not closing connections.
Thx
janmeier commentedon Jun 10, 2014
@miklacko More unit-tests are always welcome
janmeier commentedon Jun 10, 2014
But apart from that, as mick mentioned the connection management is due for a re-factor
mickhansen commentedon Jun 10, 2014
And that re-factor has been started, but it's gonna be a little while before it's done.
mickhansen commentedon Jun 12, 2014
Should be solved by #1892 - I would like people to try out this pull request and let me know if it solves their issue.
mickhansen commentedon Jun 12, 2014
@maximeCony i implemented your test in a modified way (your test was broken in multiple ways) in: 3495887
maximeCony commentedon Jun 16, 2014
@mickhansen I had to remove transactions from my project. I will reimplement them as soon as I am upgrading Sequelize (currently on 2.0.0-dev10)
I'll let you know.
Thanks a lot!
mickhansen commentedon Jun 17, 2014
@maximeCony great
BhuvaneshwaranR commentedon Oct 15, 2021
Is this issue resolved?
kishita101 commentedon Jan 6, 2024
I am still facing the same issue!