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
ETIMEDOUT exception brings down connection to database #3895
Comments
Try lowering the idle timeout for Sequelize, it appears to be lower than what your database allows. |
You mean higher than what my database allows? I'll try and report back. Are there any considerations to be aware of when lowering the idle timeout, like is there a recommended minimum idle time? |
Higher yes :) Well you probably want atleast a few seconds of minimum idle time, but you could set it as high as your server is set to. It's just important that it's not higher than the server's idle time since it sequelize will then use connections that the server has already timed out. |
I recently reconfigured Anyway, I'll lower the |
@fredrikekelund Hmm alright, yea should probably work then. |
Unfortunately, lowering I'm not sure if this is much additional help, but this is what the error looks like when actually logging it out:
If there is additional debugging work I can do, please let me know @mickhansen. I could maybe try turning on Bluebird's long stack traces if that could be of any help? |
@fredrikekelund The error is coming from the database so stack trackes likely wouldn't tell us much. Maybe Sequelize is reusing a dead connection incorrectly? I'm not sure. |
Is there any debugging work I can do to determine if that's the case? I've resorted to trying |
You can fiddle around here https://github.com/sequelize/sequelize/blob/master/lib/dialects/postgres/connection-manager.js and here: https://github.com/sequelize/sequelize/blob/master/lib/dialects/abstract/connection-manager.js Specifically you might want to tjek if |
It seems I was able to avoid this problem by setting |
@fredrikekelund It shouldn't be, minConnections above 0 should mean that the pool keeps one connection alive at all time (meaning that when it times out it starts a new one), it shouldn't have an impact on this since with 0 it should create fresh connections too and discard timed out ones aswelll. |
Hmm alright, so far it does seem a little like this might've helped the problem though. Let me keep an eye out for the next few days and I'll report back on how the system is running. I'll try and test to roll back to |
For some odd reasons , this solved my problem too. Had min:0 and changed it to min:1 and so far no timeout error Also @mickhansen - is there any way we can do this : http://stackoverflow.com/questions/30811228/sequelize-single-instance-not-working-after-module-exports It will help me buld module apps using Sequalize and Express. Currently I paste everything in one server.js file or create new Define () in each page |
Same or similar error here.
I'm having the same error with a postgres database. Tried minConnections: 1, tried with 0. Lowered maxIdle a lot. Used a local database, a remote one, with and without user athentication. The postgres database gets the login event since I can see It logged and if I try with a wrong password the error gets raised. Psql works perfectly with the remote and the local database so it is not a connectivity issue. I'm out of ideas. Forgot to add that it worked on another installation. Don't know if it is an specific version bug. |
Did someone ever found out what this problem is? I am facing the same issue right now. Will try setting |
@felimartina Still no luck for me. I tried the above suggestions of setting the minConnections to 1 and nothing. Did you happen to solve this issue? |
@garretttaco Nop :( |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment 🙂 |
I get this error also. I tried to set the min: 1 and idle: 30000 (30 seconds) in the pool settings but it didn't solve my issue.
|
I'm facing the same situation. |
I have the same problem... ETIMEDOUT connection error with mysql and postgres... But it works with sqlite and the express example (with slight modifications) |
The following command solved my situation: More details at http://docs.aws.amazon.com/redshift/latest/mgmt/connecting-firewall-guidance.html#connecting-firewall-guidance.change-tcpip-settings |
Ok i'm don't know if anyone thought of this, but it was the mistake i made so i'm gonna share it. What didn't work wasn't sequelize, but the fact that i didn't have a mysql server running... sqlite doesn't require one so it works. It may be obvious to some but i figured it out only recently. |
+1
|
If there are any plan to resolve this issue ? Our service will crash after running for some time. T_T |
@OliverLonghi does not work for me |
same error, on aws ec2. anyone can help? |
If any of you are seeing this error consistently, you have a firewall problem. I guarantee it. Something, somewhere is stopping the connection. It mostly likely isn't your Sequelize settings. With that said, we see this error very rarely, but maybe once every 500 times an AWS Lambda starts up. It only happens when the Lambda is fresh (ie. hasn't been run in over 20 mins) and needs to make an initial connection. Once the Lambda has started it'll re-use the old connection and this problem will never happen. We're running on Sequelize 3.30.4, Node 6.10.3 and MySQL ^2.13.0. My connection pool settings look like this:
What's even stranger, is that I have other Lambdas that share the exact same startup code (I mean exactly the same zip, different method) that startup a second or two before I see this error and they run fine. They're all connecting to the same RDS database, which shows about 5 DB connections at the time (not high at all) nor a high load on the DB. It's very strange. Here's the full stack trace:
I suspect there's something wrong at the connection pool level, but I'm not sure how to diagnose this further. Any ideas? |
I seem to have fixed my problem by upgrading MySQL from 2.13.0 to 2.15.0 (currently the latest). I haven't seen this in 3 weeks since doing that. |
I'm experiencing the same problem when using AWS Lightsail connecting to and RDS instance. I haven't solved it yet, but this snippet from the docs is helping: |
As @rsshilli said, something was blocking the connection, in my case, i had to allow inbound connections from heroku ip to my rds database in AWS. |
We've struggled with this issue for quite long, but worked around with the below at the end:
|
I've encountered the same issue while using Amazon RDS (Aurora PostreSQL). I've tweaked inbound connections for the security group and everything is working like a charm now. |
Hi @dts-peter, what do you mean by "tweaked inbound connections for the security group"? What did you change? |
@jared-evari You need to update your inbound connections. Go to the databases list in your AWS Console, select the database that you need to update, then do a search on the page for 'VPC security groups' (it's under the 'Security' label). You will see the link for the security group under the 'VPC security groups'. Open that link. In the bottom of the page, select 'Inbound' tab. Press 'Edit', then 'Add Rule'. Enter the following values: |
My situation was like what @dts-peter said, but with Google Cloud SQL. |
In addition to @sharq88 's options above, this one helps too:
Here's the link to the SO page, so you don't have to copy & paste: https://stackoverflow.com/a/52465919/491553 |
These issues with sequelize timeout keep getting closed but no solution have ever being posted. |
How did you resolve it? |
For people experiencing issues in AWS Lambda, I have created a pull request that documents how to properly configure |
This is a great resource. Thanks for the help @marcogrcr. |
at Socket.emit (node:events:527:28) Am also having the same issue kindly can you assist |
In my case I had this issue in for loop when not using AWAIT for async operation. As you know, this leads to possibility of firing dozens of promises almost at one moment and some (just one, for instance) of them can easily be rejected because of db connection pool overlimit. |
I'm using Sequelize 3.1.0 (haven't had time to update to 3.2.0 yet) with node 0.12.4 and I'm having pretty severe issues around communicating with Postgresql.
The problem is that I get an ETIMEDOUT exception, which seems to crash Sequelize. I get this exception 5 times on an app which uses a connection pool that can have a maximum of 5 connections, so I'm thinking that this happens once per connection, even more so because these 5 errors also occur at the same time. Here's the log:
After the error, Sequelize stops logging, but no exceptions are thrown when trying to save data.
I've tried finding out some details about the ETIMEDOUT error, but there wasn't much to go on. Here's an example of a ticket in
node-mysql
that looks similar to this one, though mysqljs/mysql#904The text was updated successfully, but these errors were encountered: