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

Sometimes problem matchers don't find the end pattern on Windows #152634

Closed
Tyriar opened this issue Jun 20, 2022 · 7 comments
Closed

Sometimes problem matchers don't find the end pattern on Windows #152634

Tyriar opened this issue Jun 20, 2022 · 7 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug papercut 🩸 A particularly annoying issue impacting someone on the team tasks Task system issues terminal General terminal issues that don't fall under another label terminal-conpty Integrated terminal issues related to the ConPTY backend upstream Issue identified as 'upstream' component related (exists outside of VS Code) windows VS Code on Windows issues
Milestone

Comments

@Tyriar
Copy link
Member

Tyriar commented Jun 20, 2022

I have the following task.json:

{
  "type": "npm",
  "script": "watch-esbuild",
  "group": "build",
  "isBackground": true,
  "problemMatcher": {
    "fileLocation": "relative",
    "pattern": [
      // Doesn't match esbuild errors, just here to get background to work
      {
        "regexp": "^([^\\\\s].*)\\\\((\\\\d+,\\\\d+)\\\\):\\\\s*(.*)$",
        "file": 1,
        "location": 2,
        "message": 3
      }
    ],
    "background": {
      "activeOnStart": true,
      "beginsPattern": "build started",
      "endsPattern": "build finished"
    }
  },
  "presentation": {
    "group": "vscode"
  }
},

Sometimes this happens where the problem matcher never stops it's progress indicator:

image

This is because of conpty causing onLineData to fire something unexpected. Given that this problem isn't likely to go away from conpty, what if on Windows we verified the last line was actually checked after the terminal has been idle for a little bit, that way the problem would be self correcting for a lot of cases shortly after builds finish (provided the end pattern was the last line).

Version: 1.69.0-insider (user setup)
Commit: fbf1cf3
Date: 2022-06-17T05:16:33.731Z
Electron: 18.3.3
Chromium: 100.0.4896.160
Node.js: 16.13.2
V8: 10.0.139.17-electron.0
OS: Windows_NT x64 10.0.22000

@Tyriar Tyriar added tasks Task system issues terminal General terminal issues that don't fall under another label labels Jun 20, 2022
@alexr00
Copy link
Member

alexr00 commented Jun 20, 2022

This seems like a reasonable approach. What is the unexpected line data that's getting fired?

@Tyriar
Copy link
Member Author

Tyriar commented Jun 20, 2022

Not sure, repro is unclear and you need escape sequence logging enabled when it happens to see what it would be

@Tyriar Tyriar added the bug Issue identified by VS Code Team member as probable bug label Jun 29, 2022
@Tyriar Tyriar added this to the Backlog milestone Jun 29, 2022
@Tyriar Tyriar added the windows VS Code on Windows issues label Jun 29, 2022
@alexr00 alexr00 removed their assignment Jun 30, 2022
@r3m0t
Copy link
Contributor

r3m0t commented Jul 15, 2022

I having the same issue, are you accepting pull requests for this?

@Tyriar
Copy link
Member Author

Tyriar commented Jul 15, 2022

@r3m0t you could give it a shot as we probably won't be looked at it soon 👍

Code pointer to the terminal task code: https://github.com/microsoft/vscode/blob/8f58d9df260144d72545f66a964e88232d751f5f/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts

@meganrogge can you give a pointer for where problem matchers get evaluated?

@meganrogge
Copy link
Contributor

protected tryFindMarker(line: string): IProblemMatch | null {
let result: IProblemMatch | null = null;
if (this.activeMatcher) {
result = this.activeMatcher.next(line);
if (result) {
this.captureMatch(result);
return result;
}
this.clearBuffer();
this.activeMatcher = null;
}
if (this.buffer.length < this.bufferLength) {
this.buffer.push(line);
} else {
const end = this.buffer.length - 1;
for (let i = 0; i < end; i++) {
this.buffer[i] = this.buffer[i + 1];
}
this.buffer[end] = line;
}
result = this.tryMatchers();
if (result) {
this.clearBuffer();
}
return result;
}

@r3m0t
Copy link
Contributor

r3m0t commented Jul 15, 2022

Looks like my issue is a separate one, webpack isn't emitting newlines so onLineData isn't fired- (I have process.env.WEBPACK_CLI_START_FINISH_FORCE_LOG set to "1" )

https://github.com/webpack/webpack-cli/blob/d390d32fe0f2491c5cc3a8dfae3ccc3962a5911b/packages/webpack-cli/src/plugins/CLIPlugin.ts#L58-L61

esbuild does emit newlines as shown in @Tyriar 's screenshot and here:

https://github.com/evanw/esbuild/blob/698898f86615a69f52d2e00681a13fe2b8635e88/pkg/api/api_impl.go#L1269

I didn't repro @Tyriar 's issue. I think I'll just submit a PR to webpack to solve my issue.

@Tyriar
Copy link
Member Author

Tyriar commented Dec 16, 2024

This issue seems to originate from an upstream component and is not something VSCode can fix by making a change to our code. As such, I will go ahead and close it. Please try to reproduce in Windows Terminal and report to microsoft/terminal with repro steps.

If you cannot reproduce in Windows Terminal, chances are it's fixed in a later version of Windows. You can read more about how we consume conpty here. Additionally, soon we plan on shipping conpty v2 with VS Code which should bring our behavior in line with Windows Terminal. Thanks for understanding.

/label upstream terminal-conpty windows

@Tyriar Tyriar closed this as completed Dec 16, 2024
@vs-code-engineering vs-code-engineering bot added upstream Issue identified as 'upstream' component related (exists outside of VS Code) terminal-conpty Integrated terminal issues related to the ConPTY backend labels Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug papercut 🩸 A particularly annoying issue impacting someone on the team tasks Task system issues terminal General terminal issues that don't fall under another label terminal-conpty Integrated terminal issues related to the ConPTY backend upstream Issue identified as 'upstream' component related (exists outside of VS Code) windows VS Code on Windows issues
Projects
None yet
Development

No branches or pull requests

4 participants