Giter Site home page Giter Site logo

Comments (7)

RyanCavanaugh avatar RyanCavanaugh commented on August 16, 2024 1

@mhamann you should be able to attach a debugger using the instructions here https://github.com/Microsoft/TypeScript/wiki/Debugging-Language-Service-in-VS-Code

I'd add a conditional break here:

        if (current.escapedName !== InternalSymbolName.Default && current.escapedName !== InternalSymbolName.ExportEquals) {
            const final = cb(current.name);
            if (final) return final;
        }
        if (chain.length > 10000) debugger; // <--- ADD
        chain = append(chain, current);
        current = current.flags & SymbolFlags.Alias ? checker.getImmediateAliasedSymbol(current) : undefined;

and see what's going on. The info in the locals in that function should give you a pretty good idea of what's going on. It looks like there's a thing we wrongly believe to be an alias of itself, but that construction should be impossible. It should be possible to make a minimal repro using only the relevant declarations from your code

from typescript.

mjbvz avatar mjbvz commented on August 16, 2024

Are you able to share a project which demonstrates this issue?

from typescript.

RyanCavanaugh avatar RyanCavanaugh commented on August 16, 2024

Invalid array length
RangeError: Invalid array length
at Array.push ()
at append

This stack would indicate an array hitting the 4 billion element cap... 😨

from typescript.

mhamann avatar mhamann commented on August 16, 2024

@mjbvz unfortunately, I can't share the project directly. it's proprietary code. happy to hop on a screen share or run specific commands if that would help.

@RyanCavanaugh i'm wondering if there's a looping issue somewhere here, because there's no way this project is that big.

from typescript.

szuend avatar szuend commented on August 16, 2024

We see this error in the Chrome DevTools code base. We use the bundled tsserver in node_modules/typescript/lib which is 5.5.3.

Instructions for getting the source: https://chromium.googlesource.com/devtools/devtools-frontend/+/main/docs/get_the_code.md#standalone-checkout-checking-out-source

No building required, just open the checkout with any IDE that uses either the bundled tsserver or some 5.5 version for LSP.

from typescript.

szuend avatar szuend commented on August 16, 2024

Unfortunately I don't have concrete repro steps to trigger the RangeError. It happened a couple of times while working in NamesResolver.ts (specifically while working on this CL https://crrev.com/c/5718090).

The relevant part of the log:

Err 10497 [10:19:48.042] Exception on executing command {
  "seq": 1388,
  "type": "request",
  "command": "getCodeFixes",
  "arguments": {
    "file": "<path>/devtools/devtools-frontend/front_end/models/source_map_scopes/NamesResolver.ts",
    "startLine": 642,
    "startOffset": 17,
    "endLine": 642,
    "endOffset": 27,
    "errorCodes": [
      2304
    ],
    "startPosition": 24760,
    "endPosition": 24770
  }
}:

    Invalid array length

    RangeError: Invalid array length
        at Array.push (<anonymous>)
        at append (<path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:2976:6)
        at forEachNameOfDefaultExport (<path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:138688:13)
        at <path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:155182:115
        at <path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:138534:119
        at forEachExternalModule (<path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:138594:7)
        at forEachExternalModuleToImportFrom (<path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:138534:3)
        at getExportInfos (<path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:155177:3)
        at <path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:155113:24
        at flatMap (<path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:2629:17)
        at getFixesInfoForNonUMDImport (<path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:155107:10)
        at getFixInfos (<path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:154943:12)
        at Object.getCodeActions (<path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:154086:18)
        at <path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:151145:46
        at flatMap (<path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:2629:17)
        at Object.getFixes (<path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:151145:10)
        at <path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:149425:33
        at flatMap (<path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:2629:17)
        at Object.getCodeFixesAtPosition (<path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:149423:12)
        at IpcIOSession.getCodeFixes (<path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:191090:50)
        at getCodeFixes (<path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:189174:43)
        at <path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:191397:69
        at IpcIOSession.executeWithRequestId (<path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:191389:14)
        at IpcIOSession.executeCommand (<path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:191397:29)
        at IpcIOSession.onMessage (<path>/devtools/devtools-frontend/node_modules/typescript/lib/typescript.js:191439:51)
        at process.<anonymous> (<path>/devtools/devtools-frontend/node_modules/typescript/lib/tsserver.js:523:14)
        at process.emit (node:events:514:28)
        at emit (node:internal/child_process:937:14)
        at process.processTicksAndRejections (node:internal/process/task_queues:83:21)

from typescript.

mhamann avatar mhamann commented on August 16, 2024

This looks like it could be the same bug: #59201

The latest VS Code - Insiders build seems to be working for me...

from typescript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.