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

Window freeze when receiving lots of output (renderer) #12265

Closed
StefH opened this issue Sep 19, 2016 · 25 comments
Closed

Window freeze when receiving lots of output (renderer) #12265

StefH opened this issue Sep 19, 2016 · 25 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Milestone

Comments

@StefH
Copy link

StefH commented Sep 19, 2016

  • VSCode Version: 1.5.2
  • OS Version: Windows 2008R2

Steps to Reproduce:

  1. Open an Java Maven project with a lot of tests
  2. Do a maven clean install as task command

You get an error message like:
2016-09-19_14h30_47

When you wait until Maven is finished running all the tests, the VS Code windows are completely blocked.

Is there a way to increase the time-out from the OUTPUTwindow?

@chrmarti chrmarti added the info-needed Issue requires more information from poster label Sep 20, 2016
@chrmarti
Copy link
Contributor

Couldn't reproduce with a long-running task with lots of output on both OSX and Windows 10. It looks like the large amount of output did slow things down though. The fact that the task runs for a long time shouldn't cause any of this.

@StefH Could you paste your tasks.json for comparison? Thanks.

@StefH
Copy link
Author

StefH commented Sep 20, 2016

tasks.json

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "0.1.0",
    "command": "mvn",
    "isShellCommand": true,
    "showOutput": "always",
    "suppressTaskName": true,
    "tasks": [
        {
            "taskName": "clean"
        },
        {
            "taskName": "compile",
            "args": [
                "clean",
                "install"
            ],
            "isBuildCommand": true
        },
        {
            "taskName": "test"
        },
        {
            "taskName": "package"
        },
        {
            "taskName": "verify"
        }
    ]
}

@chrmarti chrmarti added the bug Issue identified by VS Code Team member as probable bug label Sep 20, 2016
@chrmarti chrmarti assigned dbaeumer and unassigned chrmarti Sep 20, 2016
@chrmarti chrmarti added tasks Task system issues and removed info-needed Issue requires more information from poster labels Sep 20, 2016
@chrmarti
Copy link
Contributor

Related to #7353

@dbaeumer dbaeumer removed the tasks Task system issues label Sep 21, 2016
@dbaeumer dbaeumer assigned isidorn and unassigned dbaeumer Sep 21, 2016
@dbaeumer
Copy link
Member

This is actually a problem of the output window. Moving to @isidorn.

@dbaeumer
Copy link
Member

I saw the same behavior last week when enabling typescript server tracing which writes a lot of output. In this setup no tasks are involved.

@isidorn
Copy link
Contributor

isidorn commented Sep 21, 2016

September to investigate

@isidorn isidorn added this to the September 2016 milestone Sep 21, 2016
@isidorn
Copy link
Contributor

isidorn commented Sep 28, 2016

@dbaeumer can you please share your reproducable steps since I do not want to setup java in order to investigate this. How to setup typescript server tracing and how to get that huge amount of output? Thanks!

@isidorn isidorn added the info-needed Issue requires more information from poster label Sep 28, 2016
@dbaeumer
Copy link
Member

Settings:

{
    "typescript.tsserver.trace": "verbose"
}

Open content assist quite frequently in a project that has a browser environment.

@isidorn isidorn removed the info-needed Issue requires more information from poster label Sep 28, 2016
@bpasero bpasero self-assigned this Sep 28, 2016
@bpasero
Copy link
Member

bpasero commented Sep 29, 2016

I am not convinced that this is an issue with the output panel. I rather believe this is an issue with the extension host pumping data to the renderer and then getting stuck. I have test cases that produce the freeze when run from an extension and no freeze when run within the workbench:

Freeze from Extension (simple hello world extension with hello world command):

'use strict';

import * as vscode from 'vscode';

export function activate(context: vscode.ExtensionContext) {
    let disposable = vscode.commands.registerCommand('extension.sayHello', () => {
        vscode.window.showInformationMessage('Crashing!');
        const outputChannel = vscode.window.createOutputChannel("Test");
        outputChannel.show();
        lotsOfOutput(outputChannel);
    });

    context.subscriptions.push(disposable);
}

var max = 10000;
var i = 0;
function lotsOfOutput(outputChannel) {
    setTimeout(() => {
        outputChannel.appendLine(`[Trace - 9:21:49 AM] Sending request: quickinfo (89). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "c:\\Users\\bpasero\\Desktop\\test-ts\\src\\extension.ts",
    "line": 8,
    "offset": 17
}`);
    i++;
    if (i < max)
        lotsOfOutput(outputChannel);
    }, 1);
}

No Freeze within Workbench (for testing purposes change the CloseEditorAction in actions.ts (vs\workbench\electron-browser\actions.ts) and invoke it:

export class CloseEditorAction extends Action {

    public static ID = 'workbench.action.closeActiveEditor';
    public static LABEL = nls.localize('closeActiveEditor', "Close Editor");

    constructor(
        id: string,
        label: string,
        @IOutputService private outputService: IOutputService,
        @IWorkbenchEditorService private editorService: IWorkbenchEditorService
    ) {
        super(id, label);
    }

    public run(): TPromise<any> {
        const channel = this.outputService.getChannel("foo");
        channel.show();

        lotsOfOutput(channel);

        return TPromise.as(false);
    }

    private appendOutput(channel): void {

    }
}


var max = 10000;
var i = 0;
function lotsOfOutput(outputChannel) {
    setTimeout(() => {
        outputChannel.append(`[Trace - 9:21:49 AM] Sending request: quickinfo (89). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "c:\\Users\\bpasero\\Desktop\\test-ts\\src\\extension.ts",
    "line": 8,
    "offset": 17
}`);
    i++;
    if (i < max)
        lotsOfOutput(outputChannel);
    }, 1);
}

Adding @jrieken to the thread. I wonder if the direct call to append is too aggressive and needs some buffering.

@jrieken
Copy link
Member

jrieken commented Sep 29, 2016

@bpasero @dbaeumer Things are being mixed up here. The initial bug talks about task.json which doesn't go via the extension host. Somehow you now brought the extension host into the game which is different.

@jrieken
Copy link
Member

jrieken commented Sep 29, 2016

Also - if many messages are being send, a warning should be printed

@bpasero
Copy link
Member

bpasero commented Sep 29, 2016

@jrieken yup, @dbaeumer filed a similar issue and I merged it here. see #12265 (comment)

Bottom line is that the TS extension can produce lots of output when the tracing option is turned on and this output is being send from the extension host.

@jrieken
Copy link
Member

jrieken commented Sep 29, 2016

It actually does

screen shot 2016-09-29 at 10 05 42

@bpasero
Copy link
Member

bpasero commented Sep 29, 2016

Btw I am on Windows 10 and see this, did not try on Mac. I am also scrolling in the output when this happens. The process monitor shows no activity when this happens, so it is not stuck in high CPU or high memory.

@jrieken
Copy link
Member

jrieken commented Sep 29, 2016

45% of the time is spend in the OutputService, 17% in the OutputEditor, 7% GC'ing

screen shot 2016-09-29 at 10 09 04

CPU-20160929T100930.cpuprofile.zip

@jrieken
Copy link
Member

jrieken commented Sep 29, 2016

So, I don't believe this is an issue specific to the extension host (albeit some more buffering could happen) but I see that most work is being spend in the parts outlined above.

@bpasero
Copy link
Member

bpasero commented Sep 29, 2016

@jrieken can you reproduce the freeze? is this profile from running from extension host or main side?

@bpasero
Copy link
Member

bpasero commented Sep 29, 2016

Also I am not convinced this issue can be tracked down by profiling: When VSCode freezes, there is no high CPU activity nor memory pressure.

@jrieken
Copy link
Member

jrieken commented Sep 29, 2016

@bpasero It is very slow and 'yes' this is the main side (OutputService, string-utils etc).

@dbaeumer
Copy link
Member

dbaeumer commented Sep 29, 2016

@StefH reported this when executing a task which is executed in the render (no extension host involved).

@bpasero may be an easy way to reproduce this is to write a node program that simply produces lots of output and start it via a task.

@bpasero
Copy link
Member

bpasero commented Sep 29, 2016

Ok lets keep this item to look into the performance on the renderer side and #6737 to check for the extension side.

@bpasero bpasero changed the title Output window is not responding when the build command takes a long time Window freeze when receiving lots of output (renderer) Sep 29, 2016
@bpasero
Copy link
Member

bpasero commented Sep 29, 2016

I am seeing half of the time spend in the editor in setValue and about 15% in the append function of the outputService:

image

@bpasero bpasero modified the milestones: October 2016, September 2016 Sep 29, 2016
@bpasero
Copy link
Member

bpasero commented Sep 29, 2016

For October to investigate if we can make this faster when lots of output is received. Moving since it is not a regression from previous milestones.

@bpasero
Copy link
Member

bpasero commented Oct 14, 2016

@isidorn leaving to you if there is something we can improve. otherwise, the hang in the renderer is a different issue unrelated to consuming the output (related: #13736 and #13667)

@isidorn
Copy link
Contributor

isidorn commented Oct 26, 2016

@bpasero looked in the output and there is nothing obvious to improve. AFAIK the slowness comes from nodejs/node#7657 as you pointed out in a different issue.
Thus closing this

@isidorn isidorn closed this as completed Oct 26, 2016
@bpasero bpasero added the verified Verification succeeded label Oct 28, 2016
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
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 verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

6 participants