tediousjs / node-mssql

Microsoft SQL Server client for Node.js
https://tediousjs.github.io/node-mssql
MIT License
2.22k stars 464 forks source link

ConnectionError: Connection not yet open. #1636

Closed devnostic closed 2 months ago

devnostic commented 2 months ago

I am getting the following issue when more than 1 person is using the site in production. (Azure app service) It works fine locally and in production when only 1 person is accessing. After that, it will cause this error and reboot the service.

2024-04-23T22:59:52.514040443Z: [ERROR] /home/site/wwwroot/node_modules/mssql/lib/base/connection-pool.js:109
2024-04-23T22:59:52.514081945Z: [ERROR] return shared.Promise.reject(new ConnectionError('Connection not yet open.', 'ENOTOPEN'))
2024-04-23T22:59:52.514089346Z: [ERROR] ^
2024-04-23T22:59:52.514094546Z: [ERROR]
2024-04-23T22:59:52.514099146Z: [ERROR] ConnectionError: Connection not yet open.
2024-04-23T22:59:52.514103746Z: [ERROR] at Proxy._acquire (/home/site/wwwroot/node_modules/mssql/lib/base/connection-pool.js:109:36)
2024-04-23T22:59:52.514108747Z: [ERROR] at Proxy.acquire (/home/site/wwwroot/node_modules/mssql/lib/base/connection-pool.js:95:56)
2024-04-23T22:59:52.514113347Z: [ERROR] at Immediate.<anonymous> (/home/site/wwwroot/node_modules/mssql/lib/tedious/request.js:409:19)
2024-04-23T22:59:52.514118847Z: [ERROR] at processImmediate (node:internal/timers:466:21) {
2024-04-23T22:59:52.514123447Z: [ERROR] code: 'ENOTOPEN'
2024-04-23T22:59:52.514128047Z: [ERROR] }
2024-04-23T22:59:52.727367331Z: [ERROR] npm notice
2024-04-23T22:59:52.727401633Z: [ERROR] npm notice New major version of npm available! 9.6.4 -> 10.5.2
2024-04-23T22:59:52.727426334Z: [ERROR] npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.5.2>
2024-04-23T22:59:52.727432634Z: [ERROR] npm notice Run `npm install -g npm@10.5.2` to update!
2024-04-23T22:59:52.727438035Z: [ERROR] npm notice
2024-04-23T22:59:53.453795322Z: [INFO] fail: Middleware[0]
2024-04-23T22:59:53.454639760Z: [INFO] Failed to forward request to http://169.254.136.2:8080. Encountered a System.Net.Http.HttpRequestException exception after 1055.833ms with message: An error occurred while sending the request.. Check application logs to verify the application is properly handling HTTP traffic.
2024-04-23T22:59:53.454653361Z: [INFO] fail: Middleware[0]
2024-04-23T22:59:53.454659761Z: [INFO] Failed to forward request to http://169.254.136.2:8080. Encountered a System.Net.Http.HttpRequestException exception after 1019.100ms with message: An error occurred while sending the request.. Check application logs to verify the application is properly handling HTTP traffic.
dhensby commented 2 months ago

Seems like you're closing the pool once you've finished dealing with the first user. But not really able to help without any code or other info.