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

Build task not found sometimes #173384

Closed
rebornix opened this issue Feb 3, 2023 · 24 comments · Fixed by #181516, #186025, #186946, #187069 or #187159
Closed

Build task not found sometimes #173384

rebornix opened this issue Feb 3, 2023 · 24 comments · Fixed by #181516, #186025, #186946, #187069 or #187159
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug confirmed Issue has been confirmed by VS Code Team member papercut 🩸 A particularly annoying issue impacting someone on the team tasks Task system issues verified Verification succeeded
Milestone

Comments

@rebornix
Copy link
Member

rebornix commented Feb 3, 2023

  • Install Java extension pack
  • Open VS Code repo
  • Cmd+Shift+B
  • 🐛 Java extension prompts error and the task detection never finishes
@meganrogge
Copy link
Contributor

We have to wait for extensions to be registered before reading the tasks because of task contributions from extensions. I don't think we can change this. @alexr00 thoughts?

@alexr00
Copy link
Member

alexr00 commented Feb 6, 2023

We could have a timeout per task provider. If a task provider doesn't provide tasks for 3 minutes after we ask for tasks then it's likely it will never provide tasks. That would let us show the tasks for all the other extensions except the slow one.

@meganrogge meganrogge added tasks Task system issues debt Code quality issues labels Feb 6, 2023
@joyceerhl
Copy link
Contributor

joyceerhl commented Mar 8, 2023

I just hit this again #176536, #173184 in a VS Code instance that had been running for quite some time. Are there logs that we can provide next time this happens? I enabled trace logging and looked in the Tasks output channel but did not see anything other than a warning about shell tasks being unavailable.

@meganrogge meganrogge added this to the March 2023 milestone Mar 8, 2023
@meganrogge
Copy link
Contributor

I will try to get to this in March, no logs are needed as we understand how this could happen

@meganrogge meganrogge modified the milestones: March 2023, April 2023 Mar 20, 2023
@meganrogge meganrogge modified the milestones: April 2023, May 2023 Apr 21, 2023
@Tyriar Tyriar added bug Issue identified by VS Code Team member as probable bug papercut 🩸 A particularly annoying issue impacting someone on the team and removed debt Code quality issues labels May 3, 2023
@meganrogge meganrogge added the confirmed Issue has been confirmed by VS Code Team member label May 4, 2023
@meganrogge
Copy link
Contributor

Original repro steps still work 👍🏼

meganrogge added a commit that referenced this issue May 4, 2023
@vscodenpa vscodenpa added unreleased Patch has not yet been released in VS Code Insiders insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels May 4, 2023
@rzhao271 rzhao271 added the verified Verification succeeded label May 31, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jun 19, 2023
@meganrogge meganrogge reopened this Jun 22, 2023
@meganrogge
Copy link
Contributor

meganrogge commented Jun 22, 2023

Steps still work sometimes - saw this when I reproduced
Screenshot 2023-06-22 at 2 59 44 PM

@meganrogge
Copy link
Contributor

Apparently this still happens

@meganrogge meganrogge reopened this Jun 27, 2023
@meganrogge meganrogge modified the milestones: June 2023, July 2023, Backlog Jun 27, 2023
@meganrogge meganrogge changed the title Extensions blocking task detection Build task not found sometimes Jul 3, 2023
@meganrogge
Copy link
Contributor

meganrogge commented Jul 3, 2023

ok in OSS where I'm reproducing, it goes in here like I thought

Screenshot 2023-07-03 at 12 44 03 PM

then there are no workspace tasks found
Screenshot 2023-07-03 at 12 45 25 PM

so it goes here
Screenshot 2023-07-03 at 12 46 26 PM

@meganrogge
Copy link
Contributor

only the ContributedTasks are used here

Screenshot 2023-07-03 at 12 49 07 PM

@meganrogge
Copy link
Contributor

meganrogge commented Jul 3, 2023

so the issue is the ConfiguredTasks aren't resolved in this case. it's not timing dependent - I can repro long after the window has opened.

Screenshot 2023-07-03 at 12 50 31 PM

@meganrogge
Copy link
Contributor

I think contributed here should have a size > 0

Screenshot 2023-07-03 at 12 56 08 PM

@meganrogge
Copy link
Contributor

interesting - I wonder if this is the issue
Screenshot 2023-07-03 at 1 18 24 PM

@meganrogge
Copy link
Contributor

worked:
Screenshot 2023-07-03 at 1 43 08 PM

failed:
Screenshot 2023-07-03 at 1 44 02 PM

@meganrogge
Copy link
Contributor

so I think what's happening is if I trigger the build task before folder open, the promise is set but the tasks for that folder aren't parsed. then we return that promise indefinitely.

I think checking if the runSource is folderOpen is in order here and in that case, we want to update the workspace tasks instead of returning the promise

@meganrogge
Copy link
Contributor

yep - I believe that works.

Screenshot 2023-07-03 at 1 48 34 PM

So the repro is to run the build task before the folder opens.

meganrogge added a commit that referenced this issue Jul 3, 2023
@meganrogge meganrogge modified the milestones: Backlog, July 2023 Jul 3, 2023
@meganrogge
Copy link
Contributor

Just reproduced twice. When I did, both times it said this:

Warning: npm tasks are unavailable in the current environment.

Warning: npm tasks are unavailable in the current environment.

Warning: npm tasks are unavailable in the current environment.

Warning: npm tasks are unavailable in the current environment.

Warning: npm tasks are unavailable in the current environment.

Warning: npm tasks are unavailable in the current environment.

Warning: shell tasks are unavailable in the current environment.

Warning: shell tasks are unavailable in the current environment.

Warning: npm tasks are unavailable in the current environment.

Warning: gulp tasks are unavailable in the current environment.

Warning: shell tasks are unavailable in the current environment.

Warning: shell tasks are unavailable in the current environment.

Warning: npm tasks are unavailable in the current environment.

Warning: shell tasks are unavailable in the current environment.

Warning: npm tasks are unavailable in the current environment.

Warning: shell tasks are unavailable in the current environment.

Warning: shell tasks are unavailable in the current environment.

Warning: shell tasks are unavailable in the current environment.

Warning: shell tasks are unavailable in the current environment.

Warning: process tasks are unavailable in the current environment.

Warning: shell tasks are unavailable in the current environment.

Warning: shell tasks are unavailable in the current environment.

Warning: shell tasks are unavailable in the current environment.

Warning: shell tasks are unavailable in the current environment.

Warning: shell tasks are unavailable in the current environment.

Warning: shell tasks are unavailable in the current environment.

Warning: shell tasks are unavailable in the current environment.

Workspace folder was undefined
Workspace folder was undefined

@meganrogge meganrogge reopened this Jul 5, 2023
meganrogge added a commit that referenced this issue Jul 5, 2023
@meganrogge
Copy link
Contributor

still happens in the build I created with the latest fix. note that i don't see extensions getting activated in the status bar here at all 🤔

I also don't see the workspace folder undefined message anymore, but still see that the tasks are unavailable in the current environment.

build.mov

@meganrogge meganrogge reopened this Jul 5, 2023
@meganrogge
Copy link
Contributor

the moment I change the tasks.json file, it starts to work. IE when this is called

return this._updateWorkspaceTasks(TaskRunSource.ConfigurationChange);

@meganrogge
Copy link
Contributor

While it's possible (extremely rare) that a user will still hit this if they run the build task before a particular execution context has been set, this fix will prevent that from reproducing.

To verify, open VS code (typically a restart) and run the build task. If you do see the quickpick instead of the default build task getting, run, then the next time you run the build task, you should not see it.

The above should be hard to reproduce though - and only possible if you time it just right. Before, this would happen more frequently and was reproducible until window reload.

@joyceerhl joyceerhl added the verified Verification succeeded label Jul 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.