codeql icon indicating copy to clipboard operation
codeql copied to clipboard

General issue - CodeQL exiting with exit code 2

Open ricardo-noyolalozano opened this issue 2 years ago • 7 comments

/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?

ricardo-noyolalozano avatar Nov 21 '23 18:11 ricardo-noyolalozano

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/

MathiasVP avatar Nov 22 '23 09:11 MathiasVP

@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.

ricardo-noyolalozano avatar Nov 22 '23 19:11 ricardo-noyolalozano

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.

MathiasVP avatar Nov 23 '23 10:11 MathiasVP

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.

berkon avatar Dec 15 '23 08:12 berkon

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:

  • Which CodeQL version are you running?
  • Which OS is CodeQL running on?
  • Which language?
  • If this is a open-source repository: Could you provide an Action run with debugging enabled?

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

MathiasVP avatar Dec 15 '23 10:12 MathiasVP

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 avatar Jan 14 '24 16:01 berkon

Any update on this issue?

berkon avatar Feb 06 '24 11:02 berkon