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

go build hangs after codeql init #2589

Open
csandanov opened this issue Nov 11, 2024 · 3 comments
Open

go build hangs after codeql init #2589

csandanov opened this issue Nov 11, 2024 · 3 comments

Comments

@csandanov
Copy link

Hi,

I'm trying out codeql, after running codeql init for go language and with the debug flag I build my app with go build -x and it just hangs, no output. I use the same steps to build my app in a separate workflow where there's no codeql and it works just fine. Running locally with codeql CLI (macos arm64) also works.

My workflow (simplified):

    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Initialize CodeQL
        uses: github/codeql-action/init@v3
        with:
          languages: go
          debug: true

      - name: Build app
        run: go build -x

      - name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@v3

I tried autobuild but after a few minutes it just hangs on one of the go files and I don't know why, would be great to learn how can I debug this.

Thank you.

@aeisenberg
Copy link
Contributor

aeisenberg commented Nov 12, 2024

Not sure what is happening here. Can you please re-run the action in debug mode and share the debug artifact that gets uploaded after the run completes?

If this is a private repo, you can raise a support request, share the artifact in the request, and someone will look at it. If the repo is public, can you share a link here?

@csandanov
Copy link
Author

It's a private repo. Could you please clarify about debug mode and the artifact? I'm running init with the debug flag and also set ACTIONS_RUNNER_DEBUG: true

But the build just hangs, I see the following error after the timeout:

The hosted runner: GitHub Actions 177 lost communication with the server. 
Anything in your workflow that terminates the runner process, starves it for CPU/Memory, or blocks its network access can cause this error.

So no sarif file uploaded because compilation not even completed.

I'm surprised why autobuild works (but still hangs at some point) but go build -x produces no output and just hangs.

@aeisenberg
Copy link
Contributor

Can you try clicking "re-run failing jobs" and make sure the "Debug" checkbox is selected. It has a similar effect to what you've already done, but I believe it will also upload the build logs as artifacts, but if you're getting "lost communication with the server", that may not be any help.

Another thing you can try is to coerce the go build command to print more output. Try adding -v and -work flags. They might tell you more about where the problem is happening.

Also, if you have terminal access to the runner, could you zip the partially created database? Then create a support request and attach the database to the request.

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

No branches or pull requests

2 participants