8000 `rkt image gc` does not consider prepare and run_prepared as having been used · Issue #3387 · rkt/rkt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Feb 24, 2020. It is now read-only.

rkt image gc does not consider prepare and run_prepared as having been used #3387

Open
dansteen opened this issue Nov 17, 2016 · 3 comments
Open

rkt image gc does not consider prepare and run_prepared as having been used #3 8000 387

dansteen opened this issue Nov 17, 2016 · 3 comments

Comments

@dansteen
Copy link

Environment

rkt Version: 1.19.0
appc Version: 0.8.8
Go Version: go1.7.3
Go OS/Arch: linux/amd64
Features: -TPM +SDJOURNAL
--
Linux 4.7.0-0.bpo.1-amd64 x86_64
--
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
--
systemd 230
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN

What did you do?

$ sudo rkt image list
ID                      NAME                                                                                    SIZE    IMPORT TIME     LAST USED
sha512-6807fc094d72     coreos.com/rkt/stage1-coreos:1.19.0                                                     102MiB  1 minute ago    1
minute ago
sha512-893b2f49db6b     <host>/api:9118b14222f3973806cb762bde7ddde9171cf956   68MiB   1 minute ago    1
minute ago
sha512-b7d5fcc132bd     <host>/java:4.0.6                                              407MiB  35 seconds ago  35 seconds ago
sha512-5d072546239b     <host>/traitify-base:1.0.11                                    46MiB   27 seconds ago  27 seconds ago
sha512-2222d0a86708     quay.io/coreos/alpine-sh:latest                                                         5.4MiB  26 seconds ago  26 seconds ago


$ sudo rkt run <host>/api:9118b14222f3973806cb762bde7ddde9171cf956 --exec /bin/sleep -- 2

$ sleep 300

$ sudo rkt image list
ID                      NAME                                                                                    SIZE    IMPORT TIME     LAST USED
sha512-6807fc094d72     coreos.com/rkt/stage1-coreos:1.19.0                                                     102MiB  6 minutes ago   6
minutes ago
sha512-893b2f49db6b     <host>/api:9118b14222f3973806cb762bde7ddde9171cf956   68MiB   6 minutes ago   6
minutes ago
sha512-b7d5fcc132bd     <host>/java:4.0.6                                              407MiB  5 minutes ago   5
minutes ago
sha512-5d072546239b     <host>/traitify-base:1.0.11                                    46MiB   5 minutes ago   5
minutes ago
sha512-2222d0a86708     quay.io/coreos/alpine-sh:latest                                                         5.4MiB  5 minutes ago   5
minutes ago

$ sudo rkt prepare <host>/api:9118b14222f3973806cb762bde7ddde9171cf956 --exec /bin/sleep -- 2
294e0092-8520-4e9f-8c3a-f241535969fb
$ sudo rkt run-prepared 294e0092-8520-4e9f-8c3a-f241535969fb

$ sudo rkt image gc --grace-period=2m
successfully removed aci for image: "sha512-6807fc094d72cb9c60ca0f9b0108366a101a1b8c73236b9898fc8bb9aa0a3554"
successfully removed aci for image: "sha512-893b2f49db6bb3b5e55667375c0f212ed4d4c9d72ba8878ac4820e230e90005e"
successfully removed aci for image: "sha512-b7d5fcc132bdb005766e96a92fb778957aa48840662779c77a4a08c48f9ab38d"
successfully removed aci for image: "sha512-5d072546239b5bb960866e25b2e392fea23c91f6de1cae5ed6f206fbcae4ec11"
successfully removed aci for image: "sha512-2222d0a867084bc1c6f47f86982867dcc013a1bcfab15128a1065108808fc998"
gc: 5 image(s) successfully removed

What did you expect to see?

I expected rkt to not remove the images that had prepare and run_prepared run against them within the last 2 minutes.

What did you see instead?

rkt does not consider prepare and run_prepared as having been "last used" and deletes them.

@lucab
Copy link
Member
lucab commented Nov 18, 2016

See the explanation at #3385 (comment). This seems to me a duplicate of that, linked to the same root cause. Am I missing something or may I just close this @dansteen?

@dansteen
Copy link
Author

@lucab thanks for the reply!

I'm not sure if this is the same issue or not. I would assume that the prepare command would create all the resources needed for a pod. In that case, I don't understand why it doesn't update the last used field currently (since, per you're comments in #3385 , it's using that to determine the value). But then, I'm really just making assumptions :-)

@lucab
Copy link
Member
lucab commented Nov 18, 2016

You are right, I mixed things up and forgot some bits there. It looks like the "last used" field is indeed not correctly updated under some circumstances. This is is somehow related to rendering and overlay, as I didn't see this happening when using --no-overlay. My guess is that we always update it when rendering, but we somehow take shortcuts for the overlay case and forgot to update the DB. I didn't dig into the code there yet, though.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants
0