-
Notifications
You must be signed in to change notification settings - Fork 443
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
Query never gets cancelled regardless of requestTimeout setting. #1485
Comments
So, this one is a tough nut. The SQL query you're executing starts immediately sending a response (I think You can add your own timer and call |
Alright, I tried implementing it like so:
Seems to work fine. |
What is your opinion on adding an option for a maximum lifetime of a query to the connection settings? Or adding a TSDoc comment about this somewhere. |
@AdamJohnSwan Yeah, we definitely need to call out that the Would you be open to provide a pull request for that? Long term, I want to replace the timeout options with |
Yea I can put a PR together. |
Software versions
Additional Libraries Used and Versions
My proof of concept only requires ts-node and tedious.
Table schema
No table schema for this.
Connection configuration
Problem description
Hello, I am running into a problem where a query will run forever regardless of the
requestTimeout
option. It seems to be the case if the query runs an infinite loop. I thought that when the requestTimeout was reached the query would get cancelled. But that is not the case.Expected behavior
The query gets cancelled after it reaches my
requestTimeout
(2 seconds).Actual behavior
The query will never stop until I shutdown my application.
Error message/stack trace
No error messages, since the query runs forever.
Any other details that can be helpful
I found a way to reproduce it.
Attached is my test file. I changed it to a txt for uploading. Anyway, change it to a
.ts
file and run withts-node test.ts
.It makes a connection to a sql database running on localhost with a request timeout of 2 seconds and tries to run this query.
Due to the
continue
statement the while loop never finishes. I thought that the query would get cancelled after two seconds but instead it runs forever. If the continue statement is removed the query will get cancelled after two seconds.test.txt
The text was updated successfully, but these errors were encountered: