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

CodeQl Cli - The process cannot access the file '<path>\build-tracer.log' because it is being used by another process. #18924

Closed
Jaxelr opened this issue Mar 4, 2025 · 7 comments
Assignees
Labels
C++ question Further information is requested

Comments

@Jaxelr
Copy link

Jaxelr commented Mar 4, 2025

Language: C++
Environment: Windows 11
Tool: Codeql CLI
Command: codeql database create --language=cpp --source-root=
Version: v2.20.5

Hey team,

Whenever I try to run locally the codeql-cli I am receiving an error indicating, my build completes successfully but the bundle cannot complete:

[2025-03-04 11:36:27] [build-stdout]   Utilization:          100.0    Average Utilization: 100.0
[2025-03-04 11:36:27] [build-stdout] Build succeeded.
[2025-03-04 11:36:27] [build-stdout] "C:\Users\jrojaslopez.REDMOND\src\ms\Ess.Sign.Acs.Client\src\Azure.CodeSigning.Dlib\Azure.CodeSigning.Dlib.vcxproj" (rebuild target) (1) ->
[2025-03-04 11:36:27] [build-stdout] (CoreCppClean target) ->
[2025-03-04 11:36:27] [build-stdout]   C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppClean.targets(77,5): warning : The process cannot access the file '\\?\c:\temp\databases\cpp\log\build-tracer.log' because it is being used by another process. [C:\Users\jrojaslopez.REDMOND\src\ms\Ess.Sign.Acs.Client\src\Azure.CodeSigning.Dlib\Azure.CodeSigning.Dlib.vcxproj]
[2025-03-04 11:36:27] [build-stdout]     1 Warning(s)
[2025-03-04 11:36:27] [build-stdout]     0 Error(s)
[2025-03-04 11:36:27] [build-stdout] Time Elapsed 00:00:12.31
[2025-03-04 11:36:27] [build-stdout] Exit code 0

As a result of this, I can't complete the bundle for cpp that I'm required to do:

⚡  🚀 λ =>  codeql database bundle --mode=clear --output=C:\temp\cpp.zip C:\temp\databases\cpp
A fatal error occurred: Database at C:\temp\databases\cpp has not been finalized; refusing to bundle.
@Jaxelr Jaxelr added the question Further information is requested label Mar 4, 2025
@mbg
Copy link
Member

mbg commented Mar 4, 2025

Hi @Jaxelr 👋🏻

It's a bit unusual to see that the build seems to be trying to access that log file. Is there a chance that CoreCppClean target is trying to delete files used by / created by CodeQL?

Are you able to share more logs or the contents of C:\temp\databases\cpp? If you can't share this publicly, there are internal channels available as well.

@mbg mbg added the C++ label Mar 4, 2025
@Jaxelr
Copy link
Author

Jaxelr commented Mar 6, 2025

Certainly @mbg, Thanks. I am sharing the logs from my execution (it was done on my local corp machine).

log.zip

@mbg
Copy link
Member

mbg commented Mar 7, 2025

Thanks for sharing those logs. Just to confirm, is that all that you found in C:\temp\databases\cpp or just the logs?

I don't see anything in the logs that gives more of an indication of what's going on. It still seems to me like the CoreCppClean task may, for some reason, be trying to delete the \\?\c:\temp\databases\cpp\log\build-tracer.log file. That also suggests to me that it may likely be trying to delete other files in the database folder, which would then explain why the database is not finalised when you are trying to bundle it up.

@mbg mbg self-assigned this Mar 7, 2025
@Jaxelr
Copy link
Author

Jaxelr commented Mar 7, 2025

Silly me, I just attached the logs, here's the entirety of what was generated by the command. Apologies for the hassle.

cpp.zip

@mbg
Copy link
Member

mbg commented Mar 7, 2025

Thanks, that's been helpful. I can see that we have this error at the end of the log

[ERROR] database finalize> CodeQL detected code written in C/C++ but could not process any of it. For more information, review our troubleshooting guide at https://gh.io/troubleshooting-code-scanning/no-source-code-seen-during-build.

and that the database does not seem to contain any information about source files that were successfully extracted. There is some guidance on https://docs.github.com/en/code-security/code-scanning/troubleshooting-code-scanning/no-source-code-seen-during-build related to this error. That page is about the (equivalent) error in a Code Scanning setting, but points 3 and 4 are also relevant to CLI usage.

Can you confirm that your build performs a fresh build of all the source files you wish to analyse and does not use any cached results? I think it does, but if you could confirm that you see all the build steps in the output that you'd expect for a fresh build, that'd be great.

@mbg
Copy link
Member

mbg commented Mar 7, 2025

Ah, disregard that. One of my colleagues on the relevant engineering team has pointed out that your project appears to be a C++/CLI project, which is not supported by CodeQL.

@Jaxelr
Copy link
Author

Jaxelr commented Mar 7, 2025

@mbg oh wow, thanks for the insight. I'll be closing this Issue then.

@Jaxelr Jaxelr closed this as completed Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C++ question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants