I'm noticing that my queries appear to randomly disconnect from the server. I run the query, make some changes, and then run it again less than a minute later, and, instead of running, I'm prompted to connect again.
It's happened several times today, and today is the first time I've tried this thing. No servers have been rebooted, no changes made, the query window just disconnects itself.
I faced the same issue.
We do have a few known scenarios where the editor connection will be incorrectly closed. For example, when changing themes the editor connection will be closed. We'll fix the bugs we're aware. Please update this issue with repro steps if you are able to pin point a particular trigger for the behavior you're seeing.
When back to the editor after idle for some time. I can't query using query window. It gave me following error message. Tried to refresh the connection as well. I have to restart the application to work it again.
`Started executing query at Line 1
Query failed: BeginExecuteReader requires an open and available Connection. The connection's current state is closed.
Total execution time: 00:00:00`
I'll take this. @viraths pointer is extremely helpful - I can certainly fix this part of the code.
For reference, the issue is that most code paths use our ReliableConnectionHelper when using a data reader. This always re-opens a closed connection before execution but has the limitation that it'll do retry logic. The Query execution path intentionally uses the underlying connection, so it needs to handle reopening closed connections itself. I will work to implement this so we don't fail in this case.
I believe the fix should be in this: https://github.com/Microsoft/sqltoolsservice/pull/549. @bartedgerton and @praveenksharma I believe it'll solve your issues in addition to @viraths one, but won't have full confirmation until you can test it out in the next release. Thanks again for raising this.
Hey @kevcunnane , Thanks for quick response. The tool looks very good and easy to use so far. Keep up the good work. Thanks again.
Most helpful comment
We do have a few known scenarios where the editor connection will be incorrectly closed. For example, when changing themes the editor connection will be closed. We'll fix the bugs we're aware. Please update this issue with repro steps if you are able to pin point a particular trigger for the behavior you're seeing.