codeql icon indicating copy to clipboard operation
codeql copied to clipboard

TypeScript: CodeQL seems to hang after 44s and stops after 6h

Open Apollon77 opened this issue 1 year ago • 5 comments

Description of the issue

CodeQL was generally working great for @project-chip/matter.js, but now with adding much more auto-generated code (and yes getting a bit fancy on TypeScript edges) the processing hangs at after 44s ... and then stops after 6h

See: https://github.com/project-chip/matter.js/actions/runs/8195839329/job/22414867564?pr=715

Apollon77 avatar Mar 08 '24 07:03 Apollon77

Hi @Apollon77 👋

Thanks for reporting this. I can reproduce your problem locally. It seems that both in your workflow and locally, extraction gets stuck on packages/matter.js/src/node/ServerNode.ts and I can confirm that commenting out the contents of that file allows extraction to succeed again. Concretely, the problem seems to be with the following two definitions:

static async create<
        This extends typeof ServerNode<any>,
        T extends ServerNode.RootEndpoint = ServerNode.RootEndpoint,
    >(this: This, type?: T, options?: Node.Options<T>): Promise<ServerNode<T>>;

static async create<
        This extends typeof ServerNode<any>,
        T extends ServerNode.RootEndpoint = ServerNode.RootEndpoint,
    >(this: This, config: Partial<Node.Configuration<T>>): Promise<ServerNode<T>>;

If either one of these is commented out, then we can also analyse the file successfully. I will pass this on to our JavaScript team. In the meantime, the above might allow you to make some temporary adjustments to your code to allow CodeQL to successfully analyse your project.

You could also use a custom CodeQL configuration file to filter out the path of this file.

mbg avatar Mar 08 '24 10:03 mbg

Thank you for reacting that fast, thats awesome. We will do the temporary exclusion I think

Apollon77 avatar Mar 08 '24 12:03 Apollon77

PS: seems that /home/runner/work/matter.js/matter.js/packages/matter.js/test/behavior/definitions/descriptor/DescriptorServerTest.ts also has comparable issue because it now hangs there when I exclude the above file. I have now excluded all test files as well (which makes sense anyway), but maybe something your JS guys want to look into for the reason

Apollon77 avatar Mar 08 '24 15:03 Apollon77

@mbg is there any news on this issue? We restructured our project and now interestingly we are faced with several more places where CodeQL just hangs :-( (basically likely still that one class .. but now also many places where the class is used)

https://github.com/project-chip/matter.js/pull/1189/files#diff-12783128521e452af0cfac94b99b8d250413c516ec71fe6d97dbea666ff7ba27R40

Apollon77 avatar Sep 17 '24 10:09 Apollon77

Hi @Apollon77, sorry about that. I have let the JS team know that this is still an issue.

mbg avatar Sep 17 '24 10:09 mbg