Comments (6)
Would you think your descriptions matches the ones in #738 ? That change has been released in v3.4.4 today. Would be nice if you all could give that a try and report back.
from postgres.
Facing same issue
from postgres.
Facing same issue
Hi @Miraj98, thanks for responding. Do you have any hints where and when you are facing this problem?
Is it correlated to transactions (sql.begin)? Does it correlate to the time the process is running?
What are your connection settings? Are you able to reproduce it?
What are your postgres client options?
maybe also @porsager has some hints for us, where we should look at to find something?
from postgres.
Facing same issue
Hi @Miraj98, thanks for responding. Do you have any hints where and when you are facing this problem? Is it correlated to transactions (sql.begin)? Does it correlate to the time the process is running? What are your connection settings? Are you able to reproduce it? What are your postgres client options?
maybe also @porsager has some hints for us, where we should look at to find something?
Hey @JuHwon I just did some debugging and I am facing connection issues specifically when using bun so not sure if my case will help. Sorry.
from postgres.
Facing same issue
Hi @Miraj98, thanks for responding. Do you have any hints where and when you are facing this problem? Is it correlated to transactions (sql.begin)? Does it correlate to the time the process is running? What are your connection settings? Are you able to reproduce it? What are your postgres client options?
maybe also @porsager has some hints for us, where we should look at to find something?Hey @JuHwon I just did some debugging and I am facing connection issues specifically when using bun so not sure if my case will help. Sorry.
i would not exclude the possibility that the issue is related when the only difference is using bun vs node, right?
from postgres.
TLDR:
Every transaction has to run on the same connection, therefore for every transaction a new connection has to remain open until the transaction ends.
PostgresQL default connection limit is 100, hence you can only use 100 transactions concurrently (unless you changed it on the database level).
I'm not sure why the queries get stuck if that limit is reached, and I advise you to use the options stated below on how to debug and research the issue.
In depth:
A few days ago a co-worker any myself were presented with a similar issue when using Drizzle-ORM and using postgres.js as the handler.
We found a few interesting things.
I'll start by stating PostgresQL default number of concurrent clients is 100.
Every transaction by definition has to be done on the same connection, which means if you use them concurrently, e.g using Promise.all
and you have a lot of concurrent connections you may reach said limit.
In regards to the requests getting "stuck". This is the interesting/weird part, in essence (from our understanding) we get to a so called "deadlock".
What may happen is that if the requests are done concurrently, you may have a lot transaction start statements before even starting to processing any of them.
The expected behavior in this case is just getting an error message for too many clients, but for some reason that does not happen.
There as another issue with Drizzle but that does not effect this specific case.
What I advise you to do is to run the PostgresQL using the all
option here, e.g: PostgresQL -c log_statement=all
Then follow the logs given by the database and check if there are any errors regarding to the transactions.
Consider adding this option as well.
If you find any notes and results, I'll be happy if you share them so we can learn from it as well.
P.S I have an assumption the the connection pool has an issue when too many concurrent transactions are done currently and that's why you had this issue while doing SELECT * FROM x WHERE id = ${id}
as well but I can't be sure without specific logs from the database itself.
In addition, if possible, try to increase the max
connection option to any value > 100 and see whether you receive an error message which says that too many clients are already active. This may indicate the problem is connected to too many concurrent active transactions
from postgres.
Related Issues (20)
- Timeout issue when using with Bun HOT 17
- [question] How to get the query string before execution? HOT 3
- Nested arrays aren't expanded properly in 3.4.3 HOT 3
- Unable to parse Default Var on ALTER TABLE
- Unexpected Server Error Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. Received protocol 'cloudflare:' HOT 5
- arbitrary UNSAFE_TRANSACTION errors when using sql.begin HOT 1
- Connect-Timeout Behavior - Include Waiting for Connection Pool HOT 1
- convert a specific column when reading or writing to the database HOT 2
- nested transactions HOT 1
- Next.js: Error: A "use server" file can only export async functions. Found "sql" that is not an async function. HOT 2
- Certain transaction errors are swallowed HOT 11
- Invalid URL on README (TypeScript + Cypress) HOT 4
- Setting max: undefined results in only 1 connection being created
- ERROR: could not load library HOT 2
- Inserting raster data?
- Unable to insert values of type `bigint[]`
- Error while inserting a JSON array (if object contains the key "type")
- Not available on jsr.io HOT 1
- Unable to connect to postgres DB from Keycloak which is FIPS enabled HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from postgres.