-
Notifications
You must be signed in to change notification settings - Fork 468
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
Library doesn't recover after db recovers #701
Comments
I have enabled debugging, and here it how it looks like, maybe someone could see something in this. What i see is that, after the database is up again, a prelogin message is sent, and the socket is ended. Compared to at the beginning, when the database is up, it responds to the prelogin: connected to localhost:1433 Sent Received ..... (stop & start the database) onPoolError listener Sent |
I have recreated the same scenario just by using tedious and the library kept outputting: RequestError: Requests can only be made in the LoggedIn state, not the Final state. Looks like after the connection object had an error, and it went to Final state, it should be dropped/cleaned/evicted and not reused. Details in the ticket of tedious: tediousjs/tedious#788 |
This issue should be fixed in tedious 2.7.1 (ticket tediousjs/tedious#788 PR tediousjs/tedious#769) |
More recent versions of node-mssql have improved lifecycle management which I think should resolve this issue, so I'm closing it. Please upgrade to v4.2.2 (most recent at time of writing). If this doesn't improve things then please feel free to reopen. Particularly this could have been fixed by #683. |
Hello,
Since i couldn't reopen #610 I am creating a new one, as according to my tests, the issue persists. I made some tests (on 4.2.1) and it seems that i cannot have the script recover after the database had errors for more than a while (1 min in my case). I've put at the end of this message the two files with which i tested, and here are the tests and the results i had:
Test1 (without setting acquireTimeoutMillis; stop and start db after 10s)
script is outputting the word "tick" and the content of the db table
script is outputting the connection error and the word "tick"
after sql db is started again, all the promises of the queries that were previously run will now resolve
Test2 (without acquireTimeoutMillis; stop and start db after >1min)
script is outputting the word "tick" and the content of the db table
script is outputting the connection error and the word "tick"
after sql db is started again, the script continues to output "tick" without resolving nor rejecting neither the previous promises, nor new promises
Test3 (with acquireTimeoutMillis set to 10000; stop and start db after >1min)
script is outputting the word "tick" and the content of the db table
script is outputting the connection error, the word "tick"
and the promises of queries that took longer than 10seconds to acquire a connection are rejected with the error: TimeoutError: ResourceRequest timed out
after sql db is started again, the promises of queries continue to be rejected with the error: TimeoutError: ResourceRequest timed out
I would expect that in all these 3 types of tests, after the database is back up, to start resolving promises again. How could i achieve this, am i missing something?
index.js
app.js
The text was updated successfully, but these errors were encountered: