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
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:
pmd/pmd-core/src/main/java/net/sourceforge/pmd/lang/impl/MultiThreadProcessor.java
Line 72 in e12041c
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