microsoft / vscode-docker

Docker Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker
Other
1.22k stars 517 forks source link

It opens 2 webpages when debugging Django project with hot reloading enabled on Windows #2050

Closed v-ruizh closed 4 years ago

v-ruizh commented 4 years ago

OS: Windows 10 Build Version: 20200604.7

Repro Steps:

  1. Open a Django app in VS Code.
  2. F1 -> Docker: Add Docker Files to Workspace -> Python: Django -> Include docker compose files.
  3. Enable hot reloading.
  4. F5.

Expect: Debug successfully and open 1 webpage.

Actual: Debug successfully and it opens 2 webpages.

More Info:

  1. This issue does not reproduce with hot reloading disabled.
  2. This issue does not reproduce in Flask project.
  3. This issue does not reproduce on Mac.
bwateratmsft commented 4 years ago

@haniamr I thought we couldn't get hot reloading working?

haniamr commented 4 years ago

@bwateratmsft turns out it was an issue in my machine, but it does seem to work fine, however with this described side effect for Django apps. I'll take a closer look into this, but at a glance it seems to happen because there are 2 different processes that execute and spit out the logs we expect to launch the browser, so we launch it twice.

bwateratmsft commented 4 years ago

Ok. Might not be a serious enough issue to do in 1.3.0.

haniamr commented 4 years ago

@bwateratmsft yeah absolutely. I asked Serene to log an issue so we can keep track of it but definitely not a candidate for 1.3.

bwateratmsft commented 4 years ago

I've found what is going wrong. The Python extension sets up an inner and outer debug session, both of them get the message to open the browser, so it is opened twice. I will make a change so that only one tracker is created in this scenario, and thus only one browser tab will be opened.