brouznouf / fivem-mysql-async

MySql Async Library for FiveM
MIT License
111 stars 106 forks source link

[ERROR] connect ETIMEDOUT #130

Closed Ocean15 closed 4 years ago

Ocean15 commented 4 years ago

Still got the "[ERROR] connect ETIMEDOUT" error sporadically after server (re-)start even after #127. Don't know the source of the problem but as this was a thing here I guess it is a mysql-async script problem.

ghost commented 4 years ago

I am not experiencing that issue even with 4hr+ runs on my end. The only timeout i found was in the beginning, which i fixed.

How about you help me reproduce the issue by providing more helpful information than: I got a problem.

Ocean15 commented 4 years ago

Well I can't say much more about the problem at all. Seems to happen more or less randomly. Only thing I think I've found (or maybe its just a coincidence) is that the problem only occurs if you stop the server and boot it up. It wont occure with a restart through the "restart" button at txAdmin.

Would love to help you more than this but I actually can't. The issue is only at server start though. Not while the server is running.

My suggestion to reproduce the issue is to restart the server over and over again via "stop" and then "start" at txAdmin and not via "restart". Then sometimes it wont get a connection to the db. Can send you the logs if you need them though.

ghost commented 4 years ago

I suspect i know why the one on server start happens:

It loads resources slowly, so the by the time the resource is running, is not when the server is idle yet. So it sends out the initial connect, and then there is some load phase again, blocking the connect from finishing.

But it does not matter if the initial connect does not work. It is only one connection in the pool that failed and the resource still works; or at least when I managed to trigger it.

That hitch from the nucleus connection seemed to be interfering sometimes.

But since the changes I did not manage to trigger it again.

ghost commented 4 years ago

You can increase the connectTimeout to 20000 and the acquireTimeout to 20000 by setting both values in the connection string and hope that it helps.

e.g. connectTimeout=20000;acquireTimeout=20000.

Ocean15 commented 4 years ago

So there is no real way to fix this but increase the connectTimeout and hope thats enough?

ghost commented 4 years ago

Well, if the reason is the one I stated, the blocking of mysql-async from working than this is the fix that needs to be employed, and is the correct way of doing things (until the hitch from other resources or whatever is happening is resolved - which is not on my end). If I am wrong about the reason, then it won't help.

Because without a way to reproduce it properly, I am as in the dark as you are. So all you can do is hope I am right.

Please report back if it actually helps.

XeroDay99 commented 3 years ago

What file is connectTimeout in?

XeroDay99 commented 3 years ago

I noticed that it happened when I add more vehicles to the catalog for d3x_vehicleshop. I disabled it and it was fine.

GunMonkey26 commented 3 years ago

What file is connectTimeout in?

did you find it because im not able to find it.

XeroDay99 commented 3 years ago

Not yet...

GunMonkey26 commented 3 years ago

I tried to find it and I found something and looked up if it was it and it was so I changed it and it still didn’t work with it. I had to go to the server.cfg and where it makes a connection to the database, I added in some extra lines and now it connects. For me, it doesn’t always work in the first try so I usually have to restart it and it works. I can always paste the whole thing for you if you would like to see if that helps.

XeroDay99 commented 3 years ago

I tried a few different things that didn't work. I didn't really see any help online with it either. If you would post what you got to work that would be helpful thanks!

GunMonkey26 commented 3 years ago

Sorry for the late reply but, heres what i have that helped me fix my issue. if it works for you, let me know please lol. if you need help, add me on discord: AgentBee26#6740 "mysql://username:password@localhost/database?connectTimeout=30000&acquireTimeout=30000&waitForConnections=true&keepAlive=30&charset=utf8mb4"

XeroDay99 commented 3 years ago

Sorry for the late reply but, heres what i have that helped me fix my issue. if it works for you, let me know please lol. if you need help, add me on discord: AgentBee26#6740 "mysql://username:password@localhost/database?connectTimeout=30000&acquireTimeout=30000&waitForConnections=true&keepAlive=30&charset=utf8mb4"

That is the fix!!! Thank you!!! I owe you one!!!

GunMonkey26 commented 3 years ago

You're welcome! Glad I was able to help!

thevanillarp commented 3 years ago

Sorry for the late reply but, heres what i have that helped me fix my issue. if it works for you, let me know please lol. if you need help, add me on discord: AgentBee26#6740 "mysql://username:password@localhost/database?connectTimeout=30000&acquireTimeout=30000&waitForConnections=true&keepAlive=30&charset=utf8mb4"

where should that be pasted?

GunMonkey26 commented 3 years ago

Sorry for the late reply but, heres what i have that helped me fix my issue. if it works for you, let me know please lol. if you need help, add me on discord: AgentBee26#6740 "mysql://username:password@localhost/database?connectTimeout=30000&acquireTimeout=30000&waitForConnections=true&keepAlive=30&charset=utf8mb4"

where should that be pasted?

go in your server.cfg and where it says, "set mysql_connection_string" thats where it will go.

BlaikThaFaik commented 3 years ago

Sorry for the late reply but, heres what i have that helped me fix my issue. if it works for you, let me know please lol. if you need help, add me on discord: AgentBee26#6740 "mysql://username:password@localhost/database?connectTimeout=30000&acquireTimeout=30000&waitForConnections=true&keepAlive=30&charset=utf8mb4"

worked for me as well...been a big question for me the past few weeks much appreciated!

Musiker15 commented 3 years ago

You can increase the connectTimeout to 20000 and the acquireTimeout to 20000 by setting both values in the connection string and hope that it helps.

e.g. connectTimeout=20000;acquireTimeout=20000.

Thank you very much :D

MrBerkk commented 2 years ago

Sen artırabilir connectTimeoutiçin 20000ve acquireTimeoutiçin 20000bağlantı dizesi ve bu yardım umuduyla her iki değeri ayarlayarak.

örneğin connectTimeout=20000;acquireTimeout=20000.

+9999

QnkoChekiqta commented 1 year ago

[ script:oxmysql] Unable to establish a connection to the database (ETIMEDOUT)! [ script:oxmysql] Error undefined: connect ETIMEDOUT

i have this error please help me

Enjoy1982 commented 1 year ago

me too

XenoXzOFF commented 8 months ago

me too

set mysql_connection_string "mysql://username:password@localhost/database?connectTimeout=20000&acquireTimeout=20000&waitForConnections=true&keepAlive=30&charset=utf8mb4"