chainguard-dev / melange

build APKs from source code
Apache License 2.0
427 stars 110 forks source link

melange grinds to a halt w/ local abseil-cpp build #1651

Open dannf opened 4 hours ago

dannf commented 4 hours ago

Using v0.15.8, which uses chainguard.dev/apko v0.19.9 (but also tested building w/ chainguard.dev/apko v0.20.0).

When I'm trying to build packages against a local repo w/ locally-built packages from abseil-cpp, melange grinds to a halt when resolving dependencies:

 2 user@dann-frazier:~/os (main)$ MELANGE_EXTRA_OPTS="--log-level debug" PATH=/home/user/melange:$PATH make package/protobuf
yamlfile is protobuf.yaml
Building package protobuf with version protobuf-3.27.4-r1 from file protobuf.yaml
make yamlfile=protobuf.yaml pkgname=protobuf packages/x86_64/protobuf-3.27.4-r1.apk
[...]
2024/11/15 15:36:40 INFO     groups:
2024/11/15 15:36:40 INFO       - gid=1000(build) members=[build]
2024/11/15 15:36:40 INFO auth configured for: []
2024/11/15 15:36:40 DEBU synchronizing with desired apk world
2024/11/15 15:36:40 DEBU determining desired apk world
2024/11/15 15:36:40 DEBU performing request method=HEAD url=https://packages.wolfi.dev/os/x86_64/APKINDEX.tar.gz
2024/11/15 15:36:40 DEBU got 2 indexes:
/home/user/os/packages/x86_64/APKINDEX.tar.gz
https://packages.wolfi.dev/os/x86_64/APKINDEX.tar.gz
<---- HANGS ---->

I've given it many hours, but it never completes. Memory usage continues to grow, and it burns CPU:

    PID USER      PR  NI    VIRT    RES  %CPU  %MEM     TIME+ S COMMAND                                                                                                    
      1 root      20   0    4.2m   0.3m   0.0   0.0   0:00.01 S bash -xc chmod 0644 /etc/profile.d/* && chmod 0755 /usr/local/bin/* &&  for exe in $(find /usr/local/bin + 
    417 root      20   0    8.6m   1.0m   0.0   0.0   0:00.00 S  - sshd: /usr/sbin/sshd [listener] 0 of 10-100 startups                                                   
    782 root      20   0    9.5m   2.7m   0.0   0.0   0:00.00 S      - sshd-session: user [priv]                                                                          
    784 user      20   0   10.2m   3.8m   0.7   0.0   0:13.67 S          - sshd-session: user@pts/0,pts/1,pts/2,pts/3,pts/4,pts/5                                         
    785 user      20   0    4.8m   2.6m   0.0   0.0   0:00.02 S              - -bash 
    903 user      20   0    4.8m   0.7m   0.0   0.0   0:00.05 S              - -bash
    913 user      20   0    4.7m   0.2m   0.0   0.0   0:00.00 S              - /bin/sh -
   1413 user      20   0    5.0m   3.3m   0.0   0.0   0:00.17 S              - -bash
   7206 user      20   0    5.6m   4.6m   0.0   0.0   0:00.00 R                  - top
   1745 user      20   0    4.8m   4.1m   0.0   0.0   0:00.00 S              - -bash
   1760 user      20   0    5.2m   4.6m   0.0   0.0   0:00.16 S              - -bash
   7121 user      20   0    3.5m   2.5m   0.0   0.0   0:00.00 S                  - make package/protobuf                                                                  
   7144 user      20   0    3.5m   2.6m   0.0   0.0   0:00.00 S                      - make yamlfile=protobuf.yaml pkgname=protobuf packages/x86_64/protobuf-3.27.4-r1.a+ 
   7157 user      20   0 4699.2m 763.8m 144.0   0.6   5:15.34 S                          - /home/user/melange/melange build protobuf.yaml --repository-append /home/user+ 

Here's a session log, including a backtrace triggered by SIGABRT: console.log.txt

Here's a copy of my index and pub key for easy reproduction: test-repo.tar.gz.

smoser commented 4 hours ago

I'm 95% sure that we're in a call loop https://github.com/chainguard-dev/apko/blob/87846cbbf05d84f9b699c9a848a8ec1b539f06fd/pkg/apk/apk/repo.go#L796 .