codeql-coding-standards icon indicating copy to clipboard operation
codeql-coding-standards copied to clipboard

Feature Request: Time out long running queries

Open rak3-sh opened this issue 1 year ago • 1 comments

There is a --timeout option that can be passed to the "database analyze" step but it is not an effective way to limit the total amount of time the query evaluation can take (as mentioned already). Is it possible to have a timeout option that can prevent a query to run beyond a user configured time limit? This would greatly help in situations where users are blocked by long running queries.

rak3-sh avatar May 22 '24 02:05 rak3-sh

Hey @rak3-sh ! thanks for the issue,

Unfortunately there currently isnt a CodeQL CLI flag to be able to say "one query should timeout after X minutes",

Because we evaluate all of a set of queries in parallel, they all start execution at the same time. However, not all of the queries are worked on most of the time meaning that the timeout flag is about the same as a timeout for the whole analyse call. A hypothetical CPU-time limiting flag would work a bit better but would end up with a similar lack of guarantee (on any individual query) because sharing means it is a bit awkward which query the work can be attributed to. Plus parallelism means that threading makes this weird. Practically most of the time the problem is in a library which means a global timeout is better as it can account for everything (and that is why we prefer to use an Actions level timeout on a job rather than implementing one in the CodeQL CLI)

knewbury01 avatar May 28 '24 18:05 knewbury01