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

Prelaunch tasks without a command don't work the second time #92792

Closed
s73obrien opened this issue Mar 16, 2020 · 15 comments
Closed

Prelaunch tasks without a command don't work the second time #92792

s73obrien opened this issue Mar 16, 2020 · 15 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release tasks Task system issues verified Verification succeeded

Comments

@s73obrien
Copy link

Issue Type: Bug

Repro repo here: https://github.com/s73obrien/task-tracking-repro .

  • Clone repo and run "Launch Program" twice (2x).
  • The second time, after about 8-10 seconds, it will error out with 'The specified task cannot be tracked'.
  • Please note that this happens only after the first time running after a fresh VSCode instance is started.
  • I used ping here just for reproduction purposes.
  • This started showing up directly after the February 2020 update.
  • I can confirm that this reproduces when using only shell-based tasks (no npm involved) as well.

VS Code version: Code 1.43.0 (78a4c91, 2020-03-09T19:47:57.235Z)
OS version: Windows_NT x64 10.0.17763

System Info
Item Value
CPUs Intel(R) Core(TM) i7-4910MQ CPU @ 2.90GHz (8 x 2893)
GPU Status 2d_canvas: enabled
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: unavailable_off
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
Load (avg) undefined
Memory (System) 31.94GB (21.99GB free)
Process Argv C:\Users\sobrien\Documents\task-tracking-repro
Screen Reader no
VM 0%
Extensions (15)
Extension Author (truncated) Version
pascal ale 9.0.0
pascal-formatter ale 2.2.0
JSDocTagComplete Hoo 0.0.2
innosetup idl 1.2.0
debugger-for-chrome msj 4.12.6
show-offset ram 0.0.4
java red 0.58.0
vscode-xml red 0.10.1
addDocComments ste 0.0.8
vscodeintellicode Vis 1.2.6
vscode-java-debug vsc 0.25.1
vscode-java-dependency vsc 0.9.0
vscode-java-pack vsc 0.8.1
vscode-java-test vsc 0.22.2
vscode-maven vsc 0.21.1

(1 theme extensions excluded)

@s73obrien
Copy link
Author

I have also reproduced this without any extensions enabled

@Feynstein
Copy link

Feynstein commented Mar 16, 2020

I also have the same issue which seems to have re-appeared with the last update. It seems to be linked to issue #63705 (and multiple others linked to it) which is closed atm. I tried adding "isBackground" to my sub-tasks but nothing seems to work. I currently bypass the problem by compiling outside of vscode. It might be the version tag that's at fault, but I recently switched to vscode and I'm not fully familiar.

tasks.json
 {
    "version": "2.0.0",
    "options": {
        "cwd": "${workspaceRoot}"
    },
    "tasks": [
        {
            "label": "cmake",
            "args": ["-DCMAKE_BUILD_TYPE=Debug"],
            "type": "shell",
            "command": "cmake",
            "isBackground": true
        },
        {
            "label": "make",
            "args": ["-j16"],
            "type": "shell",
            "command": "make",
            "isBackground": true
        },
        {
            "label": "Build",
            "dependsOn": ["cmake", "make"],
            "group":"build",
        }
    ]
}
launch.json ```json

{
"version": "0.2.0",
"configurations":
[
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"cwd": "${fileDirname}"
},
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": ".../bin/program",
"args": ["--loglevel=2", "--su"],
"stopAtEntry": false,
"cwd": ".../bin/",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"preLaunchTask": "Build",
"setupCommands":
[
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": false
},
{
"description": "Enable only unhandled exceptions",
"text": "catch throw terminate",
"ignoreFailures": false
}
]
}
]
}

</details>

@alexr00
Copy link
Member

alexr00 commented Mar 17, 2020

@s73obrien thank you for the very simple example! I debugged it, and it looks like we are literally taking longer to run the tasks the second time, and because of that the debug system times out. For example, if you change your npm task to only ping 9 times instead of 12, it makes it before the debug system timeout. That's not a solution, it just illustrates what's going on.

Clearly the task system should try not to take noticeably longer to run tasks the second time; however, if you do have a long running task you could hit the debug system task timeout anyway. I'll look into what could be slowing things down so much the second time.

If you're going to have non-background tasks as your prelaunch task, they must take less than 10 seconds to run, otherwise you need to convert them into background tasks.

@isidorn FYI

@alexr00 alexr00 added bug Issue identified by VS Code Team member as probable bug tasks Task system issues labels Mar 17, 2020
@alexr00 alexr00 added this to the March 2020 milestone Mar 17, 2020
@alexr00 alexr00 changed the title Compound tasks with long-running subtasks error-out after ~10 seconds Task system taking longer to run compound tasks the second time Mar 17, 2020
@isidorn
Copy link
Contributor

isidorn commented Mar 17, 2020

Idealy we could also ask the user from debug land if after 10 seconds he wants to wait more..

@Feynstein
Copy link

Feynstein commented Mar 17, 2020

@alexr00 Can you refer me to an issue that's more related to my problem? So that I don't file a new duplicate for the background task system not working and timing out my debug session each time I change my code? Now that you have changed the name of the issue, my comment became irrelevant...

Note: it's never timedout with my setup until the last update. With very evenly distributed build times between 1s to 5m.

@s73obrien
Copy link
Author

@alexr00 For clarification:
Does the use of dependsOn force one's tasks to be run non-background? There seems to be precious little documentation about the expected behavior (unless I am missing it).
Or more to the point: why is it that, when run on its own, npm: task2 can seemingly run as long as it pleases?

@Feynstein have you tested to see if your tasks will run successfully once on a fresh instantiation of VSCode and then not-so-successfully thereafter, as described above? Your tasks.json looks identical to mine, topologically-speaking.

@Feynstein
Copy link

@s73obrien Oh yeah... I closed vscode, then clean build then reopenend and started debug and even though it was long, it did work! Then I changed a line, so there was basically only linking to do and it timed out! I'm in the right issue after all!

@alexr00
Copy link
Member

alexr00 commented Mar 17, 2020

@s73obrien the debug system defines that a non-background task needs to finish in 10 seconds. As @isidorn said, ideally we'd ask the user after 10 seconds. You can have a background task that uses dependsOn (but the task in the depends on can't be background #70283), but to be a background task that can be used as a prelaunch task you must have a watching problem matcher.

@Feynstein
Copy link

Feynstein commented Mar 17, 2020

@alexr00 But as I mentionned in my last comment, on a clean boot of vscode running my whole compilation (after a make clean) doesn't trigger any timeout. And then changing one line in one file (which is at least 10x faster) I get a timeout. Plus, it seems to have appeared with the latest update. This is unstable behaviour if I ever saw any.

@alexr00
Copy link
Member

alexr00 commented Mar 17, 2020

Yes:

Clearly the task system should try not to take noticeably longer to run tasks the second time; however, if you do have a long running task you could hit the debug system task timeout anyway. I'll look into what could be slowing things down so much the second time.

@alexr00 alexr00 added the candidate Issue identified as probable candidate for fixing in the next release label Mar 17, 2020
@bwateratmsft
Copy link
Contributor

bwateratmsft commented Mar 17, 2020

A 10 second time limit seems severely too restrictive to me. Even on a small .NET Core project, dotnet build can take 10+ seconds if NuGet restore is slow. In almost any reasonable Node.js project I can't imagine npm install taking less than 10 seconds.

According to that rule, dotnet build should become a background task, but because of #70283 that makes Docker debugging impossible, because docker build has to depend on dotnet build.

I think we should rethink that 10 second timeout. Maybe 10 seconds without any output from the task, but even that is seriously restrictive.

EDIT: Per @alexr00's reply below, it's a 10 second limit to start, not 10 seconds to finish the task.

alexr00 added a commit that referenced this issue Mar 17, 2020
@alexr00
Copy link
Member

alexr00 commented Mar 17, 2020

The 10 second timeout ended up being a red herring. There is a 10 second timeout, but is on the task starting not completing. Fix is pushed to master and will be available in the text insiders.

@alexr00 alexr00 changed the title Task system taking longer to run compound tasks the second time Prelaunch tasks without a command don't work the second time Mar 17, 2020
@bwateratmsft
Copy link
Contributor

Ah, that makes sense. Ten seconds to start is reasonable.

@haniamr
Copy link

haniamr commented Mar 17, 2020

The 10 second timeout ended up being a red herring. There is a 10 second timeout, but is on the task starting not completing. Fix is pushed to master and will be available in the text insiders.

Thanks Alex, is it going to be available in the Insiders nightly build today? Also, are there any plans to have a servicing release for the stable branch?

@Tyriar Tyriar closed this as completed Mar 17, 2020
@alexr00
Copy link
Member

alexr00 commented Mar 18, 2020

Yes, it is in the latest insiders now. It is also planned to be included in the 1.43.1 sable release.

@dbaeumer dbaeumer added the verified Verification succeeded label Mar 18, 2020
@github-actions github-actions bot locked and limited conversation to collaborators May 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release tasks Task system issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

8 participants