ioi-2023 / contestant-vm

Contestant virtual machine for online IOI (since 2020)
1 stars 2 forks source link

HIGH PRI: Can't change the Visual Studio Code Settings #78

Closed boasbakker closed 1 year ago

boasbakker commented 1 year ago

Describe the bug When trying to change the settings for Visual Studio Code, a blank screen appears without any settings.

To Reproduce Steps to reproduce the behavior:

  1. Open Visual Studio Code
  2. Click on gear icon in the bottom left of the screen
  3. Click on settings (Cntr+Comma)
  4. See the blank screen

Expected behavior A screen with various settings related to Visual Studio Code and C++ should appear, as was the case with the previous version of the VM.

Screenshots image

Please complete the following information:

Additional context

radl97 commented 1 year ago

It worked for me like this:

  1. Open Visual Studio Code
  2. In the menu, select "Open folder"
  3. Select a new directory: In the directory selector, "Create new folder" icon on the top right corner, and name it "asd"
  4. "Open" button
  5. Create and save a new file called "asd.cpp"
  6. Click on settings (Cntr+Comma)
  7. The screen works as expected.

I think the most important step is to open a new folder. I guess user-related settings could be expected to show, but as there is no active workspace, VSCode might be confused.

horcsinbalint commented 1 year ago

@boasbakker thank you for reporting the issue.

I have been able to reproduce the issue. Steps:

I do not know whether any of these steps is redundant. I have also tested natively on one of the contestant machines, and was capable of producing the issue with the same steps (except for creating a new VM, I did the setup and cleanup from the repo). Here is a video about the bug: https://youtu.be/9lkSG8uNiEI?t=75

I believe it is quite possible that these steps will be taken by contestants in the real competition. I think this bug has high priority. @radl97 do you have any idea what could potentially cause this bug to happen? I have not seen any issues relating to this on the VS Code github.

pobrn commented 1 year ago

I can consistently reproduce this issue by running:

rm -rf ~/snap/code ~/.config/Code
sudo /opt/ioi/bin/ioiconf.sh fwstart

and then start vscode, and opening File > Preferences > Settings. If one runs fwstop instead, then it works. There is no need to complete the ioisetup prompt.

Even when the firewall was enabled, I was able to make it work by running

sudo iptables -A OUTPUT -j REJECT --reject-with icmp-host-prohibited

(the --reject-with part is not necessary)

So I am guessing the reason the page does not load is because of some kind of timeout that we hit when the packets are simply dropped.

You can observe a similar behaviour when running e.g.

curl http://example.com

It will also fail only after a long timeout.

radl97 commented 1 year ago

Can you check

horcsinbalint commented 1 year ago

I have sent it in PM

pobrn commented 1 year ago

There is a bunch.

$ ss -tpnr
State    Recv-Q Send-Q Local Address:Port                 Peer Address:Port Process                           
SYN-SENT 0      1           ioi-0804:57860              152.199.19.160:443   users:(("code",pid=13528,fd=33)) 
SYN-SENT 0      1           ioi-0804:33774                 13.107.5.93:443   users:(("code",pid=13528,fd=28)) 
SYN-SENT 0      1           ioi-0804:34934   bud02s39-in-f14.1e100.net:443   users:(("code",pid=13528,fd=26)) 
SYN-SENT 0      1           ioi-0804:43156                20.189.173.9:443   users:(("code",pid=13528,fd=35)) 
SYN-SENT 0      1           ioi-0804:33778                 13.107.5.93:443   users:(("code",pid=13528,fd=29)) 
SYN-SENT 0      1           ioi-0804:57854              152.199.19.160:443   users:(("code",pid=13528,fd=32)) 
SYN-SENT 0      1           ioi-0804:52884                13.107.42.18:443   users:(("code",pid=13528,fd=38)) 
SYN-SENT 0      1           ioi-0804:42088                20.189.173.1:443   users:(("code",pid=13614,fd=48)) 
SYN-SENT 0      1           ioi-0804:34938   bud02s39-in-f14.1e100.net:443   users:(("code",pid=13528,fd=27)) 
SYN-SENT 0      1           ioi-0804:52880                13.107.42.18:443   users:(("code",pid=13528,fd=37)) 
SYN-SENT 0      1           ioi-0804:52868                13.107.42.18:443   users:(("code",pid=13528,fd=36)) 
SYN-SENT 0      1           ioi-0804:43150                20.189.173.9:443   users:(("code",pid=13528,fd=34))

As expected, the settings page appears after about 2 or so minutes.

boasbakker commented 1 year ago

Can you make a new release of the VM with this issue fixed?

radl97 commented 1 year ago

Hi! We are not actively developing the VM version at this point, as close to the contest as we are. Thank you for your understanding.

One ugly workaround I can think of off top top of my head is to shut down the network of the VM. You van do this through VM management (in the status bar, bottom right) OR in the VM's user interface (top right). Start VSCode like this, and open the options there.

On another note (another workaround), if you wait 2 minutes (for the TCP timeout), the menu does appear correctly.

boasbakker commented 1 year ago

Thank you, that works