Skip to content

[core] Support a timeout option for parser tasks #6684

@adangel

Description

@adangel

Is your feature request related to a problem? Please describe.
This issues aims for a more general solution similar to #6659 / #6660 .

Sometimes, the grammar is not written properly and the generated parser might run into a loop and needs lots of backtracking to finally say: "no, there is no way this text can be parsed".

This happened in the past for PLSQL (which is javacc based, e.g. https://sourceforge.net/p/pmd/bugs/1531/) but seems to happen as well for ANTLR based languages (like kotlin).

Describe the solution you'd like
When we run the parser task for a single file, we should wrap it and cancel it. For the multithread processor, we already wrap it, but we wait for the result infinite time:

The default timeout (e.g. 30 seconds) should be configurable.

It should be a default feature - language modules shouldn't need to do anything, to use it.

If the timeout occurs, this should result in a processing error for that single file. Other files should still be analyzed. The processing error should be reported as usual in the final report.

Describe alternatives you've considered
none

Additional context
none

Metadata

Metadata

Assignees

No one assigned

    Labels

    an:enhancementAn improvement on existing features / rules

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions