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
ESOCKET Connection Error from node js web app to MSSql Database connection #799
Comments
Hey @Praveen335 👋🏻 I‘m sorry to hear that you are facing this problem when using
Thanks! 🙇🏻♂️ |
Hi @arthurschreiber , Version Details: We had a look at active work thread to SQL server and network connectivity by raising it to Microsoft support. They mentioned all good from SQLServer end. The work thread percentage also less. I have tried to retry with custom logic. But no luck. After getting socket error, it is continuously throwing for all the subsequent requests. Any suggestion or recommendation would really help us. Currently, we are using the connection pool to connect to the Database. Thanks, |
Same here, it suddnely gets to that state and gets stuck... |
We are also seeing the same connection errors happening on our system. We are connecting a connectionPool on service start. At a random moment a request fails with:
Service restarts automatically but keeps throwing these errors for about 20 minutes. After that service restarts and it can connect again. We are seeing this with multiple node processes on this server but they are not going down simultaneously (sometimes they do), which is kinda weird. We believe the cause is in the NodeJS app and not in the mssql DB. We are using these versions: mssql: 4.3.0 (latest) |
Hi. We are also experiencing this issue. These are our versions:
|
Write your versions of MSSQL Server. Now, SQLNCLI11 is replaced by MSOLEDBSQL for MSSQL2017 instance. |
got same error when using code copied from microsoft official sample: https://www.microsoft.com/en-us/sql-server/developer-get-started/node/windows/step/2.html Finally, i solved this error by enable TCP/IP protocol in "Sql Server Configuration Manager"->"SQL Server Network Configuration"->" Protocols for "->"TCP/IP"
|
Thank you! I was having this exact issue ;) |
Since we are still experiencing this issue with almost all of our nodejs services we did some extra tests. We created a new nodejs service that is doing absolutely nothing. It is not called by another service, just runs in PM2. We got 3 errors in 5 days, happening randomly: This is the code: `
` We upgraded our SQL server but that didn't help. Updated all our packages but still got these errors. |
@TimTilroy are you using tedious to handle your connection pool or the tedious-connection-pool? If you're using the tedious project, maybe you can try the tedious-connection-pool one and see if that helps. |
Hi IanChokS, We are not using the tedious-connection-pool package, but the default connectionPool of the mssql package (its using tedious I believe). However we have updated the mssql package to version 5.1 now and it seems stable, we've got no more connection errors on our test service. One of the changes is the following:
So maybe that fixed our problem. We also set the min pool connections to 0, don't know if that could have any effect. |
@MarioPerezEsteso if you're having trouble connecting to your server, you can try to make sure that TCP IP is enabled and that You have the correct port number in your configuration to check if the server is reachable. @regevbr, @Praveen335 If you're using connection pooling, you can try and use the tarn.js library instead of the node-pool like what TimTilroy did to see if it fixes your connection issues. If not, perhaps try upgrading to the latest mssql (v5.1). |
Update: we have applied the new version of mssql (5.1.0) to all our sql services, updated the min pool connections to 0 and it looks like the connection errors stopped since our deploy. |
I think the problem is just because you are using " / " instead of " \ " in the name or smthing like that |
@Praveen335 Have you tried upgrading to the new version of mssql (5.1.0) to see if it resolves your issue? If not, feel free to re-open this issue. |
I'm using versions: I have enabled TCP/IP in configuration manager. Also all my sql services are running. yet am getting following error: C:\Nodejs\node-sql-conn\Database>node connect.js C:\Nodejs\node-sql-conn\Database\connect.js:26 This is my Code: |
This one work for me. Thank you for give me the solution. |
Im also experimenting this ESOCKET connection errors, and the issue is not related with TCP/IP since the app is connected from AWS EC2 to AS RDS and it is working most of the time. |
FINALLY I solved the error. The script I was using each time I requested a new connection:
The script that solved the issue:
where pool2Connect needs to be defined initially, when starting the script:
Hope it helps |
Hi, Please provide me a solution to resolve this |
I find myself with the same novelty, I connect without using pool, I do it to about 1000 different servers and of those 5 they present that message, it is not a TCP issue. |
This did the trick for me after trying 99% of the solutions I found online: |
I was getting the exact same error message and confirmed it wasn't TCP/IP issue. Mine turned out to be account user setting/policy issue on SQL. I've switced to another account assigned to SQL and it started to connect. |
Ttrying to connect to sql server database, giving following below error, please help on this error. ConnectionError: Failed to connect to "AWS SQL Server Database" - getaddrinfo ENOTFOUND |
Hi @MuraliPagadalaColibri, can you open a new issue? We can help you from there. |
|
Hey @TimTilroy |
Hi Team,
Currently, we are getting the intermittent connectivity issues from our web app to MsSql frequently when there is more traffic to the service.
Is there any final recommendations on this issue.
Error:
{ ConnectionError: Failed to connect to <>:1433 - Could not connect (sequence)
at Connection.tedious.once.err (D:\home\site\wwwroot\node_modules\mssql\lib\tedious.js:216:17)
at Connection.g (events.js:291:16)
at emitOne (events.js:96:13)
at Connection.emit (events.js:188:7)
at Connection.socketError (D:\home\site\wwwroot\node_modules\tedious\lib\connection.js:699:14)
at D:\home\site\wwwroot\node_modules\tedious\lib\connection.js:590:25
at SequentialConnectionStrategy.connect (D:\home\site\wwwroot\node_modules\tedious\lib\connector.js:153:9)
at Socket.onError (D:\home\site\wwwroot\node_modules\tedious\lib\connector.js:169:16)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
code: 'ESOCKET',
originalError:
Version Details:
"tedious": "2.0.1",
"mssql": "^4.0.4",
Thanks,
Praveen.
The text was updated successfully, but these errors were encountered: