Skip to content
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

Inactive connection can't reconnect with out VS Code Restart #785

Closed
julielerman opened this issue Mar 20, 2017 · 21 comments
Closed

Inactive connection can't reconnect with out VS Code Restart #785

julielerman opened this issue Mar 20, 2017 · 21 comments
Assignees
Labels

Comments

@julielerman
Copy link

  • MSSQL Extension Version: 0.3.0
  • VSCode Version: 1.10.2
  • OS Version: (thank you, dotnet --info)
    Runtime Environment:
    OS Name: Mac OS X
    OS Version: 10.11
    OS Platform: Darwin
    RID: osx.10.11-x64

Steps to Reproduce:

  1. Use mssql to connect to database, execute some queries
  2. Leave VSCode open with the connection still active and go out for a walk or something
  3. Note that connection profile is still noted in status bar of code
  4. Try to re-execute last query with CMD+Shift+E
  5. ERROR: Connection closed. It did not attempt to reconnect
  6. explicitly connected again (via ms sql connect, choose from profiles) and the problem continued to persist.
  7. shut down and restarted Code , CMD Shift E on the command in the editor gives prompt to select a profile. Query executed properly.

Next experiment ...more useful results (they may have been there the first time but I was focused on the problem, not data collection)

  1. Use mssql to connect to database, execute some queries
  2. Leave VSCode open with the connection still active and go out for a walk or something
  3. Note that connection profile is still noted in status bar of code
  4. Try to re-execute last query with CMD+Shift+E
    Again it fails to make the connection, even when I explicitly choose Connect and the profile. The error message it gives when I try to do it via "connect" is "Failed to Connect ..SocketException invalid argument"
    Closing and re-opening code fixed the problem again.
@kevcunnane
Copy link
Contributor

Thanks for raising this. We'll see if we can get someone to investigate later this sprint. It'll likely be next week before we make progress on this one.

@julielerman
Copy link
Author

just put someone on it who wants to do step 2 ...go for a walk :)

@IndifferentDisdain
Copy link

So I came across this bug as I was preparing for a lunch & learn for my company; for me, 'go for a walk' is more like 'blink twice'. Sysinfo since it's different than OP:

  • MSSQL Extension Version: 0.3.0
  • VSCode Version: 1.10.2
  • OS Version: (thank you, dotnet --info)
    Runtime Environment:
    OS Name: ubuntu
    OS Version: 16.04
    OS Platform: Linux
    RID: ubuntu.16.04-x64
    Base Path: /usr/share/dotnet/sdk/1.0.1

@zackeezy
Copy link

I'm having the same problem. It seems to get worse with time. When I first updated the extension to 0.3.0 and updated VSCode to 1.10.2 it works consistently for a while but I suddenly got the disconnect error. I could restart VSCode and get it to work for a while, but then it would error out sooner and sooner. It's practically unusable.

  • MSSQL Extension Version: 0.3.0
  • VSCode Version: 1.10.2
  • OS Version: Ubuntu 16.04, Linux Mint 18.1

@benrr101 benrr101 self-assigned this Mar 30, 2017
@benrr101
Copy link
Contributor

I'm attempting to repro this issue since it sounds pretty straight-forward. One clarifying detail I'd like to ask @zackeezy, @julielerman, and @IndifferentDisdain: were you connected to an Azure database or an on-prem server?

@zackeezy
Copy link

@benrr101 I was connecting using localhost. The database was on the same machine as my VS Code instance.

@IndifferentDisdain
Copy link

@benrr101 localhost as well

@julielerman
Copy link
Author

@benrr101 : azure

@benrr101
Copy link
Contributor

benrr101 commented Apr 3, 2017

Thanks for the feedback folks! I've gotten a repro scenario set up in Ubuntu against Azure where if I execute around 3 queries in quick succession, the backing tools service will crash and not begin working again until VS Code is restarted. I'm currently working on debugging this since there isn't anything useful coming up in the logs.

As a side note, this I suppose is covered in the first issue on the known issues page for the extension, but I think that's a cop-out akin to just saying "it's beta! it might not work!" We'll get to the bottom of this

@andrewralon
Copy link

More data!

I regularly use a VPN over wireless and find this problem consistently when VS Code has been open and had an open, working SQL connection. It is correlated to any one of the following:

  • Waking the computer from sleep
  • Wireless adapter fails to work properly after waking from sleep (disable/enable adapter in Network Connection fixes it)
  • Disconnecting from the VPN involuntarily (assumed to be automatic timeout after X hours)
  • Temporarily losing wireless connectivity

Is it unable to recover from a lost network connection?

FYI:

  • MSSQL Extension Version: 0.3.0
  • VSCode Version: 1.10.2
  • Runtime Environment:
    OS Name: Windows 7
    OS Version: 6.1.7601
    OS Platform: Windows
    RID: win7-x64

@benrr101
Copy link
Contributor

benrr101 commented Apr 6, 2017

@andrewralon Thanks for your specs!

Right now, we're hot on the trail of a very bizarre bug where on Ubuntu the backing tools service will exit -- not crash, exit -- for no reason whatsoever. I'm having such a hard time debugging it due to it's ability to evade all my attempts at breaking before it exits, I'm reaching out to some dotnet corefx devs to get their opinion. I'm unsure if this is the same as the connectivity bug @julielerman originally raised, since it sounds more like the bug raised by @zackeezy and @IndifferentDisdain. Nevertheless it's a massive issue that we need to solve.

Thanks again for your patience. We really want to make sure we've got the experience right for this tool.

@andrewralon
Copy link

@benrr101 Of course!

I love this tool and and I MUCH prefer using VS Code to SSMS as much as possible. Keep up the great work.

That said, I've already written a script to disable/enable the wireless adapter so I can power on. Haha.

@julielerman
Copy link
Author

julielerman commented Apr 6, 2017

@andrewralon I have a q for you that's loosely related to this thread. Are you on https://gitter.im/Microsoft/mssql under some alias (that I'm not discovering)?

@andrewralon
Copy link

@julielerman I am now.

@benrr101
Copy link
Contributor

I wanted to add another update to this so you don't think we're leaving you hanging. Unfortunately my efforts on this bug were deprioritized over the last couple weeks due to 1) need to get others unblocked from other bugs, 2) catching a cold, and 3) getting my wisdom teeth removed (it's been a crazy two weeks). Now that things are returning to normal, I'll be attempting to dig into the native side of the dotnet process and see if I can get more info on why the process is exiting.

@andrewralon
Copy link

Thanks. Hit me up for more details as needed on a Windows box. For me, it is predictably linked to losing connectivity / waking the PC from sleep / wireless adapter crapping out. When I restart VSCode, I can connect like normal and all is well.

@zafaralam
Copy link

Was there any update on how log it would be before a fix rolled out or a work around?

@benrr101
Copy link
Contributor

As an update, we're currently looking into upgrading our code to utilize .NET Core v2. This will allow us to get a wide variety of new functionality, improve on our installation story, and we hope will fix this issue. I believe our target for a release using .NET Core 2 is June.

@mkurz
Copy link

mkurz commented Jun 8, 2017

You may want to try the latest alpha which includes .Net Core 2, it may fixes your issues:
#718 (comment)

@MattIrv
Copy link
Contributor

MattIrv commented Dec 11, 2017

We've added some logic to automatically reconnect once a connection goes inactive in the new 1.3.0 release, which should resolve this problem. If you still see issues with connections, feel free to reopen or file a new bug though

@MattIrv MattIrv closed this as completed Dec 11, 2017
@samzuercher
Copy link

samzuercher commented Nov 21, 2023

@MattIrv Did you actually solve the problem? it seems to still exist on the newst version v1.22.0:

repro-steps:

  1. try connecting to a sql-server over VPN in vscode with the vpn disconnected: should not work
  2. connect the VPN
  3. try connecting again: sadly still is not working, as the result is cached somewhere..
  4. try connecting to another sql-server not yet used: works

I don't like the solution to "automatically reconnect". I would rather like a solution where we can clear the cache with a manual click, restart the mssql-service or delete the folder where the cached-files are.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants