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
linux: fix uv_available_parallelism using cgroup #4278
linux: fix uv_available_parallelism using cgroup #4278
Conversation
Any idea why the ASAN build is failing ? |
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.
Thanks for the PR. I pointed out single instances of style issues but please fix them all.
The ASAN buildbot is known to be problematic at the moment. You can just ignore it.
@bnoordhuis I fixed styling issues and added tests directly in test-platform-output.c. It might be a bit ugly though, happy to have your feedback on it To test it manually I built it with the following Dockerfile # Use the official Ubuntu base image
FROM ubuntu:20.04
# Update the package list
RUN apt-get update
# Install cmake and other build dependencies
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y cmake libtool autoconf build-essential
# Fix : for some reason cmake is looking for gmake instead of make
RUN ln -s /usr/bin/make /usr/bin/gmake
# Set the working directory inside the container
WORKDIR /workspace
# Create a user 'libuv' and give ownership of /workspace to 'libuv'
RUN useradd -m libuv && chown -R libuv:libuv /workspace
# Switch to the 'libuv' user
USER libuv
# Copy the current directory contents into the container at /workspace
COPY --chown=libuv:libuv ./ /workspace/
# Run the build steps as 'libuv' user
RUN mkdir -p build
RUN (cd build && cmake .. -DBUILD_TESTING=ON)
RUN cmake --build build
# By default, run a shell
CMD ["/bin/sh", "-c", "/workspace/build/uv_run_tests platform_output"] And following commands $ docker build . libuv-test-cgroup
$ docker run --cpus="2" libuv-test-cgroup | grep available It correctly outputs 2 available cpus |
@bnoordhuis have you other feedbacks ? |
Can you rebase on top of the v1.x branch? It looks like you're a few commits behind. |
f5bf3c6
to
deda40d
Compare
✅ |
uv_available_parallelism does not handle container cpu limit set by systems like Docker or Kubernetes. This patch fixes this limitation by comparing the amount of available cpus returned by syscall with the quota of cpus available defined in cgroup See issue: libuv#4146
Not working yet
deda40d
to
dd4d126
Compare
@bnoordhuis I rebased on v1.x |
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.
Thanks, LGTM.
@libuv/collaborators can one of you give this a quick high-level look-over?
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.
LGTM with a couple of comments.
@santigimeno @bnoordhuis any idea when this can be merged ? |
I'll go ahead and merge it. Thanks for the pull request. |
PR to fix #4146