-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Check that info.NCPU
is not zero
#29302
Conversation
… limit to avoid a silent hang when building
This pull request does not have a backport label. Could you fix it @Tacklebox? 🙏
NOTE: |
Pinging @elastic/elastic-agent (Team:Elastic-Agent) |
💔 Build Failed
Expand to view the summary
Build stats
Test stats 🧪
Steps errorsExpand to view the steps failures
|
Hi! We're labeling this issue as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change LGTM. We'll have to re-merge with master to check CI
## What does this PR do? This adds a check for 0 when determining the concurrency limit used by mage during a build. ## Why is it important? `docker info -f '{{ json .}}'` exits with 0 even if there was an error, so the check for `err == nil` doesn't catch errors, and the default int value of 0 is used when trying to read `info.NCPU`. This leads to the confusing behaviour where the build stops and hangs forever with no errors and no indication that anything has gone wrong unless you build with --verbose. (cherry picked from commit 10f850e)
## What does this PR do? This adds a check for 0 when determining the concurrency limit used by mage during a build. ## Why is it important? `docker info -f '{{ json .}}'` exits with 0 even if there was an error, so the check for `err == nil` doesn't catch errors, and the default int value of 0 is used when trying to read `info.NCPU`. This leads to the confusing behaviour where the build stops and hangs forever with no errors and no indication that anything has gone wrong unless you build with --verbose. (cherry picked from commit 10f850e) Co-authored-by: Maxwell Borden <[email protected]>
## What does this PR do? This adds a check for 0 when determining the concurrency limit used by mage during a build. ## Why is it important? `docker info -f '{{ json .}}'` exits with 0 even if there was an error, so the check for `err == nil` doesn't catch errors, and the default int value of 0 is used when trying to read `info.NCPU`. This leads to the confusing behaviour where the build stops and hangs forever with no errors and no indication that anything has gone wrong unless you build with --verbose.
What does this PR do?
This adds a check for 0 when determining the concurrency limit used by mage during a build.
Why is it important?
docker info -f '{{ json .}}'
exits with 0 even if there was an error, so the check forerr == nil
doesn't catch errors, and the default int value of 0 is used when trying to readinfo.NCPU
. This leads to the confusing behaviour where the build stops and hangs forever with no errors and no indication that anything has gone wrong unless you build with --verbose.Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesI have added tests that prove my fix is effective or that my feature worksCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
How to test this PR locally
Stop the docker daemon
systemctl stop docker
and ensure you don't have it set to automatically start up, either by disabling the socket or masking the service.Ensure you haven't exported
MAX_PARALLEL
in your shell.Test to make sure the daemon isn't running by executing
docker info -f '{{ json .}}'
and validating that the output looks likeAttempt to build the elastic agent.
DEV=true SNAPSHOT=true PLATFORMS=linux/amd64 TYPES=docker mage package
On main it will silently hang forever.
On this branch, print the error
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock
when it is unable to run the build.Related issues
Use cases
Screenshots
Logs