Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General issue - CodeQL exiting with exit code 2 #14866

Open
ricardo-noyolalozano opened this issue Nov 21, 2023 · 8 comments
Open

General issue - CodeQL exiting with exit code 2 #14866

ricardo-noyolalozano opened this issue Nov 21, 2023 · 8 comments
Labels
question Further information is requested

Comments

@ricardo-noyolalozano
Copy link

ricardo-noyolalozano commented Nov 21, 2023

/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 ricardo-noyolalozano added the question Further information is requested label Nov 21, 2023
@MathiasVP
Copy link
Contributor

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
Copy link
Author

@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
Copy link
Contributor

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
Copy link

berkon commented Dec 15, 2023

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
Copy link
Contributor

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!

@berkon
Copy link

berkon commented Jan 14, 2024

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
Copy link

berkon commented Feb 6, 2024

Any update on this issue?

@geraldgg
Copy link

geraldgg commented Dec 6, 2024

I have the same issue, with codeql 2.19.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants