-
Notifications
You must be signed in to change notification settings - Fork 303
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
Cannot reconnect. Please reload the window #3126
Comments
And not only when you hibernate... |
A temporary workaround I do is restarting WSL by running |
Is this perhaps related to microsoft/WSL#5324 ? |
This is very annoying. I have to reopen the window and possibly lose everything in my terminal every day. My output of
Update: I frequently lose the content of my integrated terminal sessions. This confirmed that data loss is possible and the need to increase priority for this bug. I'm very sad that this isn't even labeled a bug which means that either it can't reproduce or be confirmed on other machines. |
Same issue. WSL 1:
|
Same issue here on WSL 1.
|
This has recently started happening to me and it seems when it starts it just goes round in the "Cannot reconnect" cycle, for that reason I am switching to using a mac for development. |
My issue was that the underlying path to the project had moved and it couldn't reopen in that directory. |
The VSCode team should be merging several possible duplicates (#4686 and possibly #3454) into one to ease tracking. Everyone reported this issue in a different way due to their habit of using the computer (whether one enables hibernate/hybrid sleep and how long they keep the computer sleeping). So for those reporting that it only occurs with hybrid sleep or modern standby try performing the same steps except with regular sleep (for at least 10 hours if you have the time, if you need to do work on one computer try letting another computer/Virtual Machine sleep for 10 hours). For me, the issue (Cannot reconnect. Please reload the window) only occurs when I sleep the computer overnight. Not sure if it is due to the day incrementation, the length of the sleep (I suspect this is more likely based on the logs), or my network adaptor going to a deeper sleep state with longer sleeps. Here's my logs for both my WSL 1 and WSL 2 machine after the "Cannot reconnect" error occurs. I obtained the logs by pressing Cancel in the dialog and go to the Output tab in the bottom pane and select "Log (Window)" in the dropdown: It seems that there is some timeout in the log (and that timeout includes the sleeping time) so that explains why putting the computer to sleep long enough causes the issue:
Note that issue does not occur every time I put my computer to sleep. If the sleep period is brief and during the day, I may still get the dialog but I press "Reconnect Now" and the remote windows will reconnect. Compared to this issue that is considerably less annoying. The logs of such "expected behavior" is also attached below: System Information:
|
I've been experiencing this for... well, ever since I started using VS Code with WSL! When I see
One of the processes (there seems to be one for each VS Code window open (I usually have several) is using roughly %150 CPU, i.e. 1.5 times the CPU of one of the four CPUs in my machine (an HP Elitebook 840 G3). I use This happens always and I think only after a long (e.g. overnight) period of hibernation. My laptop does not support Modern Standby. Having killed these seemingly rogue processes (and thus their threads, of which there are about 10 per process), VS Code seems to function entirely as normal - so I wonder what these processes are doing?
|
This problem started happening to me maybe a month or two ago with WSL 1 and now it's still happening with WSL 2. It definitely happens when hibernating overnight, but when I tried hibernating and booting immediately it did not happen. After reloading the window it seems to get a new WSL instance while still leaving the old one running but unreachable. This is because I'm running a few Python servers (on localhost for development and testing) and they're still operational and accessible from my web browser, but I cannot see any of the python processes via ps. I had to
|
Following instructions from https://stackoverflow.com/a/48214059/535071, I profiled a rogue The top 8 rows by CPU time:
chokidar - npm |
The excessive CPU was caused by a symlink loop in one of my repos, and the file watcher (https://github.com/paulmillr/chokidar) not handling that situation, I removed the offending symlinks and that problem has gone away - however, I am still getting "Cannot Reconnect" - so that was a separate, but linked, issue. As noted by @kevin-he-01, the length of time in hibernation seems to be a factor, an hour or so of hibernation causes the "Reconnect Now" dialog and it successfully reconnects, often without user intervention, but overnight hibernation causes "Cannot Reconnect". It's worth adding that I tend to have multiple VS Code windows open - currently 5. I recently upgraded WSL on the Windows Insider channel, so am now running Linux kernel 5.x:
which fixes microsoft/WSL#5324, but this problem is still occurring. Is there any investigation into this problem ongoing? |
Everytime I waked from sleep, I have to reconnect vscode wsl2 all the time, which causes losing everything I already have ;( |
I'm not expert, please don't double check what I said in case of doubt I'm might just be wrong, nothing else IssueThere's a error with no detail given to the user. Reasonprobably TLS handshake (or something related to that because i'm no expert) failing during connect Workaround
WhyBecause WSL and hibernate (or other factor) don't play well and sort of "sleep the clock too"
|
For me the worst thing about this issue is losing all opened files and the state of vscode when reopening. A better fix IMO is to never lose the information about the opened files and terminals (although the process running in them could be lost; actually they were already lost, probably), unless the user explicitly choose to discard the previous state (so as to take care of cases in which vscode cannot reopen due to some problem in the state of opened files, like a huge file causing error to load and closing vscode, but at the same time not losing the state otherwise). This would be a more universal approach independent of WSL1, WSL2, SSH or something of the sort, that would probably require a fix for each individual case, like you can see at #4686 and #3454. Also, there could be cases in which the connection was really lost, but if you reopen the window, it should be opened as it was before. This might not fix the need to reload the window, tough, but at least for me the main issue would already be fixed. Edit: It seems this is already being tracked at microsoft/vscode#110062 |
Just bought a new laptop (Surface Laptop 4) with modern standby. Can no longer reproduce this exact bug anymore (on either WSL 1 or WSL 2, though on WSL 2 another similar issue is bugging me, though that one at least has a workaround) In contrast, my old laptop uses the outdated S3/S4 power model (no modern standby). My best guess is that those old laptops are not longer supported or tested by this extension anymore, so Microsoft don't have a lot of incentives in investigating an issue that only reproduces on those devices. At least now I know this issue could possibly be caused by something specific to S3/S4 devices. I even verified this with logs in the OUTPUT tab by selecting "Log (Window)" as the dropdown. When using WSL 1, I see no disconnection at all on a device with Modern Standby, but an a traditional S3/S4 device (tested on my old laptopt) I will certainly see tons of reconnection attempts on every wake-up (even when the bug does not occur):
Feel free to correct me if I am wrong. If you have a S3/S4 only device and is not able to reproduce this issue (that is, leaving it sleep overnight or at least 8 hours or so and not getting the error), please comment here. I believe some laptops even allow you to switch between traditional and modern standby in BIOS/UEFI settings which may help reproducing the issue. To check whether you have Modern Standby enter this command into Powershell/cmd powercfg /a If you see
then you have modern standby currently on. |
@kevin-he-01 - My computer is only a few months old and has modern standby. I am still having the Cannot Reconnect issue after leaving my computer overnight. I also see the issue 'Reconnecting' message if away from my desk, but in that case it successfully reconnects and nothing is lost. I often have large datasets loaded in memory and this 'Cannot Reconnect' issue is a big problem. I've changed my 'power plan' settings to disable putting the computer to sleep when plugged in to see if that will help. |
@kevin-he-01 I have checked my Surface Pro X. It has modern Standby, but still runs into this issue every single time the computer sleeps for a long enough time It will continue to try to reconnect for a good 5-10 minutes before the issue is finally resolved (sometimes) |
In case it helps diagnose it (@kevin-he-01 thanks for your post) I'm on a Win10 laptop with WSL1. In trying to fix this issue I disabled "sleeping" entirely thro the Windows power & sleep settings GUI.
but I still hit this issue sometimes :-(. |
duplicate of #3158 |
Issue Type: Bug
When I hibernate my laptop while there is an open vs code window which is connected to WSL and then later when the laptop is turned on and I try to maximum my vs code window, then I got the error "Cannot reconnect. Please reload the window"
Extension version: 0.44.2
VS Code version: Code 1.45.1 (5763d909d5f12fe19f215cbfdd29a91c0fa9208a, 2020-05-14T08:27:35.169Z)
OS version: Windows_NT x64 10.0.19041
Remote OS version: Linux x64 4.19.104-microsoft-standard
System Info
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: enabled
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled
The text was updated successfully, but these errors were encountered: