Azure / azure-cli

Azure Command-Line Interface
MIT License
3.97k stars 2.95k forks source link

`rpmbuild` 4.17.0 is slow and stuck at `Processing files` for a long time #21820

Open jiasli opened 2 years ago

jiasli commented 2 years ago

Describe the bug

Mariner 2.0 (https://github.com/Azure/azure-cli/pull/21245), UBI 8 (https://github.com/Azure/azure-cli/pull/21655) and CentOS Stream 8 (https://github.com/Azure/azure-cli/pull/20918) have rpmbuild 4.17.0 which is very slow while building the RPM. The CI job BuildRpmPackageMariner and BuildRpmPackageUbi8 take ~40min.

Turning on -vv (verbose) for rpmbuild shows the process got stuck at these steps for a very long time:

Processing files: azure-cli-dev-1.el8.x86_64
...
D:      execv(/usr/lib/rpm/pythondeps.sh) pid 4341
D:      waitpid(4341) rc 4341 status 0
D:      execv(/usr/lib/rpm/pythondistdeps.py) pid 4346
D:      waitpid(4346) rc 4346 status 0
D:      execv(/usr/lib/rpm/pythondeps.sh) pid 4347
D:      waitpid(4347) rc 4347 status 0
D:      execv(/usr/lib/rpm/pythondistdeps.py) pid 4352
D:      waitpid(4352) rc 4352 status 0
D:      execv(/usr/lib/rpm/pythondeps.sh) pid 4353
D:      waitpid(4353) rc 4353 status 0

htop shows the same:

1

To Reproduce

Run the follow commands on WSL or Linux machine:

git clone https://github.com/Azure/azure-cli
docker run -it --rm -v $(pwd)/azure-cli:/root/azure-cli --workdir /root/azure-cli registry.access.redhat.com/ubi8/ubi:8.4
yum update -y
yum install -y wget rpm-build gcc libffi-devel python3-devel openssl-devel make bash diffutils patch dos2unix python3-virtualenv perl
REPO_PATH=$(pwd) CLI_VERSION=dev rpmbuild -v -bb --clean scripts/release/rpm/azure-cli.spec

Additional context

Email: azure-cli FIPS compliance

Install htop:

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
yum install htop

See: https://www.cyberciti.biz/faq/how-to-install-htop-on-rhel-8-using-yum/

jiasli commented 2 years ago

Also tried to use iotop.

I added Extra Packages for Enterprise Linux (EPEL) and followed tutorials like

  1. https://www.cyberciti.biz/hardware/linux-iotop-simple-top-like-io-monitor/
  2. https://aws-labs.com/install-iotop-monitor-linux-disk-io-rhel-centos-fedora/
  3. https://lintut.com/install-iotop-on-linux/

but got no luck:

# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
# yum update
# yum install iotop
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 0:05:10 ago on Mon Mar 28 04:18:46 2022.
No match for argument: iotop
Error: Unable to find a match: iotop

There is a package called iotop-c but it shows empty screen (https://github.com/Tomas-M/iotop/issues/34):

# yum install iotop-c
# iotop-c

Actually, I installed iotop on fedora container (WSL2-based) without problem, but it fails with :

> docker run -it --rm fedora
# yum install iotop
# sudo iotop
Netlink error: No such file or directory (2)

The Linux kernel interfaces that iotop relies on for process I/O statistics
were not found. Please enable CONFIG_TASKSTATS in your Linux kernel build
configuration, use iotop outside a container and or share the host's
network namespace with the container.

Please do not file bugs on iotop about this.

Please enable CONFIG_TASKSTATS in your Linux kernel build configuration

This is Microsoft built WSL, I am not sure I can do that.

use iotop outside a container

Guess I need to bump up a VM for testing?

share the host's network namespace with the container

This is not possible on Windows: https://docs.docker.com/network/host/: The host networking driver only works on Linux hosts, and is not supported on Docker Desktop for Mac, Docker Desktop for Windows, or Docker EE for Windows Server.