question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Query never gets cancelled regardless of requestTimeout setting.

See original GitHub issue

Software versions

  • Tedious: 15.1.0
  • SQL Server: Microsoft SQL Server Developer (64-bit) 15.0.2095.3
  • Node.js: 6.17.0

Additional Libraries Used and Versions My proof of concept only requires ts-node and tedious.

Table schema No table schema for this.

Connection configuration

{
        server: "localhost",
        authentication: {
            type: "default",
            options: {  
                userName: "testuser",
                password: "password",
            }
        },
        options: {
            trustServerCertificate: true,
            database: "master",
            requestTimeout: 2000
        }
    }

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 with ts-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.

      declare @count int = 0
      while @count < 1
      begin
          continue;
          WAITFOR DELAY '0:10';
          set @count+=1;
      end

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

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
arthurschreibercommented, Oct 29, 2022

@AdamJohnSwan Yeah, we definitely need to call out that the requestTimeout on both the connection as well as on individual requests is only for the “request” part of things, as soon as we get a response, the timeout is cleared.

Would you be open to provide a pull request for that?

Long term, I want to replace the timeout options with AbortSignal handling instead. That way, the client can handle request cancellation in a more fine-grained way.

0reactions
AdamJohnSwancommented, Oct 31, 2022

Yea I can put a PR together.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ExecutionTimeout has no effect · Issue #3310 - GitHub
Describe the bug Execution timeout setting has no effect; the cancellation token injected into resolvers never reads as cancelled.
Read more >
How to disable timeout for nginx? - Server Fault
It may not be possible to disable it at all, yet a feasible workaround is to increase the execution time. On a nginx...
Read more >
Tuning AWS Java SDK HTTP request settings for latency ...
In this blog post, I discuss the AWS Java SDK configuration options that are available to fine-tune the HTTP request timeout and retry ......
Read more >
Increase azure web app request timeout - Stack Overflow
No, you cannot increase the timeout for Azure App Services (it is 230 seconds). You can move to a cloud services or IIS...
Read more >
NSURLSession - Different timeouts per task? - Apple Developer
Not pleasant and goes against the idea of having one session-per client-server pairing. Set the Session timeout for each task at task creation...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found