canonical / rockcraft

Tool to create OCI Images using the language from Snapcraft and Charmcraft.
GNU General Public License v3.0
35 stars 43 forks source link

`rockcraft pack` uses all available memory #122

Open gruyaume opened 2 years ago

gruyaume commented 2 years ago

OVERVIEW For a given charm, running rockcraft pack yields to the process using all the system available memory and crashing.

STEPS TO REPRODUCE

  1. Clone the repository
  2. Checkout branch lte2
  3. Run rockcraft pack (This command should crash because of an error in the rockcraft.yaml)
  4. Run rockcraft pack again (This command should crash because of the memory qty being used)

EXECUTION OUTPUT

guillaume@thinkpad:~/PycharmProjects/magma-controller-rock$ rockcraft pack -v
Starting Rockcraft 0.0.1.dev1                                                                                                                                                                                                                          
Logging execution to '/home/guillaume/.cache/rockcraft/log/rockcraft-20221012-202543.853675.log'                                                                                                                                                       
Launching instance...                                                                                                                                                                                                                                  
Starting Rockcraft 0.0.1.dev1                                                                                                                                                                                                                          
Logging execution to '/tmp/rockcraft.log'                                                                                                                                                                                                              
Retrieving base ubuntu:18.04                                                                                                                                                                                                                           
Retrieved base ubuntu:18.04 for amd64                                                                                                                                                                                                                  
Extracting ubuntu:18.04                                                                                                                                                                                                                                
Extracted ubuntu:18.04                                                                                                                                                                                                                                 
Initializing parts lifecycle | (51.5s)                                                                                                                                                                                                                 craft-providers error: Failed to execute pack in instance.                                                                                                                                                                                             
Full execution log: '/home/guillaume/.cache/rockcraft/log/rockcraft-20221012-202543.853675.log'

LOGS

2022-10-12 20:25:43.854 Starting Rockcraft 0.0.1.dev1
2022-10-12 20:25:43.859 Using default provider 'lxd' on linux system
2022-10-12 20:25:43.923 Executing on host: lxc --project default profile show local:default
2022-10-12 20:25:43.969 Using hostname 'rockcraft-magma-orc8r-controller-5129182'
2022-10-12 20:25:43.969 Launching instance...
2022-10-12 20:25:43.969 Executing on host: lxc remote list --format=yaml
2022-10-12 20:25:44.013 Remote 'craft-com.ubuntu.cloud-buildd' already exists.
2022-10-12 20:25:44.013 Executing on host: lxc project list local: --format=yaml
2022-10-12 20:25:44.068 Set LXD instance name to 'rockcraft-magma-orc8r-controller-5129182'
2022-10-12 20:25:44.068 Executing on host: lxc --project rockcraft list local: --format=yaml
2022-10-12 20:25:44.135 Executing on host: lxc --project rockcraft list local: --format=yaml
2022-10-12 20:25:44.208 Executing on host: lxc --project rockcraft start local:rockcraft-magma-orc8r-controller-5129182
2022-10-12 20:25:44.619 Executing in container: lxc --project rockcraft exec local:rockcraft-magma-orc8r-controller-5129182 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin ROCKCRAFT_MANAGED_MODE=1 cat /etc/os-release
2022-10-12 20:25:44.688 Executing in container: lxc --project rockcraft exec local:rockcraft-magma-orc8r-controller-5129182 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin ROCKCRAFT_MANAGED_MODE=1 test -f /etc/craft-instance.conf
2022-10-12 20:25:44.802 Executing on host: lxc --project rockcraft file pull local:rockcraft-magma-orc8r-controller-5129182/etc/craft-instance.conf /home/guillaume/tmp8d3rtujm.tmp-craft/tmp9qajpyea
2022-10-12 20:25:44.867 Instance is compatible with compatibility tag 'rockcraft-buildd-base-v0.0'
2022-10-12 20:25:44.867 Waiting for environment to be ready...
2022-10-12 20:25:44.867 Executing in container: lxc --project rockcraft exec local:rockcraft-magma-orc8r-controller-5129182 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin ROCKCRAFT_MANAGED_MODE=1 systemctl is-system-running
2022-10-12 20:25:45.011 systemctl is-system-running status: starting
2022-10-12 20:25:45.261 Executing in container: lxc --project rockcraft exec local:rockcraft-magma-orc8r-controller-5129182 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin ROCKCRAFT_MANAGED_MODE=1 systemctl is-system-running
2022-10-12 20:25:45.403 systemctl is-system-running status: starting
2022-10-12 20:25:45.653 Executing in container: lxc --project rockcraft exec local:rockcraft-magma-orc8r-controller-5129182 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin ROCKCRAFT_MANAGED_MODE=1 systemctl is-system-running
2022-10-12 20:25:45.751 systemctl is-system-running status: starting
2022-10-12 20:25:46.002 Executing in container: lxc --project rockcraft exec local:rockcraft-magma-orc8r-controller-5129182 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin ROCKCRAFT_MANAGED_MODE=1 systemctl is-system-running
2022-10-12 20:25:46.094 systemctl is-system-running status: starting
2022-10-12 20:25:46.345 Executing in container: lxc --project rockcraft exec local:rockcraft-magma-orc8r-controller-5129182 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin ROCKCRAFT_MANAGED_MODE=1 systemctl is-system-running
2022-10-12 20:25:46.441 systemctl is-system-running status: starting
2022-10-12 20:25:46.693 Executing in container: lxc --project rockcraft exec local:rockcraft-magma-orc8r-controller-5129182 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin ROCKCRAFT_MANAGED_MODE=1 systemctl is-system-running
2022-10-12 20:25:46.811 Waiting for networking to be ready...
2022-10-12 20:25:46.811 Executing in container: lxc --project rockcraft exec local:rockcraft-magma-orc8r-controller-5129182 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin ROCKCRAFT_MANAGED_MODE=1 getent hosts snapcraft.io
2022-10-12 20:25:46.921 Executing in container: lxc --project rockcraft exec local:rockcraft-magma-orc8r-controller-5129182 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin ROCKCRAFT_MANAGED_MODE=1 snap unset system proxy.http
2022-10-12 20:25:47.174 Executing in container: lxc --project rockcraft exec local:rockcraft-magma-orc8r-controller-5129182 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin ROCKCRAFT_MANAGED_MODE=1 snap unset system proxy.https
2022-10-12 20:25:47.416 Installing snap 'rockcraft' with channel=None and classic=True
2022-10-12 20:25:47.416 Installing snap 'rockcraft' from host (classic=True)
2022-10-12 20:25:47.433 Executing in container: lxc --project rockcraft exec local:rockcraft-magma-orc8r-controller-5129182 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin ROCKCRAFT_MANAGED_MODE=1 test -f /etc/craft-instance.conf
2022-10-12 20:25:47.517 Executing on host: lxc --project rockcraft file pull local:rockcraft-magma-orc8r-controller-5129182/etc/craft-instance.conf /home/guillaume/tmp78za9emn.tmp-craft/tmpytjlfxix
2022-10-12 20:25:47.565 Revisions found: host='383', target='383'
2022-10-12 20:25:47.565 Skipping snap injection: target is already up-to-date with revision on host
2022-10-12 20:25:47.565 Emitter: Pausing control of the terminal
2022-10-12 20:27:01.925 Emitter: Resuming control of the terminal
2022-10-12 20:27:04.488 craft-providers error: Failed to execute pack in instance.
2022-10-12 20:27:04.488 Full execution log: '/home/guillaume/.cache/rockcraft/log/rockcraft-20221012-202543.853675.log'

memory_usage_rockcraft_2

cmatsuoka commented 1 year ago

I couldn't reproduce the memory issue, in both runs the pack command stops with the error cannot create regular file '/root/stage/bin/protoc': No such file or directory. You mention branch lte2 in the steps to reproduce and it doesn´t seem to exist, should that be dev-lte2?

cjdcordeiro commented 1 year ago

@gruyaume could you please show the LXC profile you're using?