Skip to content

JS Code with static block exposes 3 issues: Crashes TypeScript language service, ErrorReporter typescript version bug, & lingering bash.exe processes leading to "console allocation failure" #46468

@DerekZiemba

Description

@DerekZiemba

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.61.2 (system setup) & maybe? 1.61.0 (system setup)
  • OS Version: Win10 Education 20H2 (OS Build 19042.1237)

This was occurring on an earlier version which prompted me to finally click Help -> Install Update. The new version exhibits the same issue. I did not make a note of the version I was coming from, but I can't recall doing an update in the last 7 days so it might be earlier than 1.61.1.

Steps to Reproduce:

  1. Create a javascript file anywhere, or not, this will crash the TypeScript language service even in an unsaved new tab.

  2. Paste the following code: [BUG # 1]:

    class ElementsArray extends Array {
      static {
        const superisArray = super.isArray;
        const customIsArray = (arg)=> superisArray(arg);
        this.isArray = customIsArray;
      }
    }
    • The TypeScript language service should now crash.
    • You may have to Reload Window or close vscode and relaunch it. This may only occur if a tab is open with the above code on vscode statup or Typescript Language Service startup. I can't check now because of bash.exe side-effect ([BUG # 3] further down) caused by this bug.
  3. With the TypeScript language service now crashed > 5 times. The ErrorReporter will prompt you to report the error.

    • [BUG # 2]: The ErrorReporter is unable to report issue because it says the TypeScript version is out of date, even if it is actually the latest version.
      image
  4. [BUG # 3]: The TypeScript Server crashing is resulting in lingering bash shells and apparently there is a limit of 32.
    image

    • EDIT: This actually brings about yet another bug:
      [BUG # 4]: VSCode refuses to display the PROBLEMS OUTPUT DEBUG CONSOLE TERMINAL panel if the terminal can't be started.

EDIT2:
I failed to mention the issue with the TypeScript language service crashing has existed for well over a month, maybe months even. Until this point I would just ignore it and avoid the file that causes the crash. I never tried to report the issue in the past because I was in fact using an older TypeScript version.

Today I finally became annoyed enough to look into it after running into and being impeded for the n-th time by the fatal error - console device allocation failure - which breaks unrelated things system wide.
I slowly removed code from that file until I was left with only the code that would cause the crash, then simplified it further to the 7 line snippet above.
After finding the root cause, I updated my typescript version to latest so that I could submit the issue. Then the rabbit hole got deeper.


EDIT3:

I originally submitted this to the vscode repo instead of the TypeScript repo because my primary beef is with vscode leaving bash.exe consoles open. I also thought the ErrorReporter being broken was a vscode thing.
Yes, the root cause is the TypeScript language server, but I feel vscode's handling of a failed language server is poor.

Metadata

Metadata

Labels

BugA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputDomain: JavaScriptThe issue relates to JavaScript specificallyFix AvailableA PR has been opened for this issueFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions