github / codeql

CodeQL: the libraries and queries that power security researchers around the world, as well as code scanning in GitHub Advanced Security
https://codeql.github.com
MIT License
7.49k stars 1.49k forks source link

General issue - CodeQL exiting with exit code 2 #14866

Open ricardo-noyolalozano opened 9 months ago

ricardo-noyolalozano commented 9 months ago

/apps/actions-runner/_work/_tool/CodeQL/2.15.2/x64/codeql/codeql database finalize --finalize-dataset --threads=4 --ram=14356 /apps/actions-runner/_work/_temp/codeql_databases/csharp Running pre-finalize script /apps/actions-runner/_work/_tool/CodeQL/2.15.2/x64/codeql/csharp/tools/pre-finalize.sh in /apps/actions-runner/_work//. Running TRAP import for CodeQL database at /apps/actions-runner/_work/_temp/codeql_databases/csharp... A fatal error occurred: Dataset /apps/actions-runner/_work/_temp/codeql_databases/csharp/db-csharp has been finalized and does not support further TRAP import. A fatal error occurred: Dataset import for /apps/actions-runner/_work/_temp/codeql_databases/csharp/db-csharp failed with code 2. Error: Encountered a fatal error while running "/apps/actions-runner/_work/_tool/CodeQL/2.15.2/x64/codeql/codeql database finalize --finalize-dataset --threads=4 --ram=14356 /apps/actions-runner/_work/_temp/codeql_databases/csharp". Exit code was 2 and error was: A fatal error occurred: Dataset import for /apps/actions-runner/_work/_temp/codeql_databases/csharp/db-csharp failed with code 2. Context: A fatal error occurred: Dataset /apps/actions-runner/_work/_temp/codeql_databases/csharp/db-csharp has been finalized and does not support further TRAP import. See the logs for more details.

This is issue is fixed if I delete the database folder but it will start up again. We had been running CodeQL nightly for months and then this issue began. I have checked the disk space and that does not seem to be an issue. Any ideas how to fix this?

MathiasVP commented 9 months ago

Hi @ricardo-noyolalozano,

Would it be possible for you to rerun the workflow with debugging enabled and send us the log files from the generated artifacts? You can see how to rerun your workflow with debugging enabled here: https://github.blog/changelog/2022-08-01-debugging-codeql-analysis-in-code-scanning-made-easier-by-obtaining-detailed-logs-and-debugging-artifacts-from-the-codeql-action/

ricardo-noyolalozano commented 9 months ago

@MathiasVP are there any particular files or folders that would be of interest? sorry just looking at some of the files I can see that some sensitive company information is on them and since this is a private repo I have to be careful.

MathiasVP commented 9 months ago

Oh, I see. Sorry, I didn't realize this wasn't in an open source repository.

We're mostly interested in the .log files from the artifact, although I can't promise that other files may not be relevant for subsequent debugging. If you open a support ticket (see https://docs.github.com/en/support/contacting-github-support/creating-a-support-ticket) then we can debug this without any fear of exposing sensitive company information.

berkon commented 8 months ago

Any idea what the reason could be. I'm experiencing exactly the same issue. The CodeQL workflow fails approx. in 50% of the workflow runs.

MathiasVP commented 8 months ago

Difficult to say without more information, unfortunately. The issue reported by the user is now being handled elsewhere. Do you mind opening a fresh issue with as much information you can so that we can debug this better? I'm thinking of information such as:

And anything else that you think may be relevant. We'll be happy to help you from there!

berkon commented 7 months ago

Hi @MathiasVP, sorry for the delay. Now I've collected some information which might be helpful:

CodeQL version: 2.15.5 OS: Linux Ubuntu (local GitHub runner) Language: Typescript/Javascript Docker Image: node:lts-bullseye

Before every run, the database is cleared with:

rm -rf "/home/relbuilder/actions-runner-2/_work/_temp/codeql_databases/javascript"

Unfortunately this is not an open source repo of my company, but I've attached some uncritical log output. It is not captured in debug mode. The problem is that if I would re-run such a failed action manually in debug mode, it always works well.

5_Initialize CodeQL.txt 6_Autobuild.txt 7_Perform CodeQL Analysis.txt

berkon commented 7 months ago

Any update on this issue?