Skip to content

Conversation

@cgwalters
Copy link
Member

I ran out of space in /tmp today and it turned out I had
a whole lot of /tmp/mantle-qemu files, including some
really big disk images. This is a combination of changes
from #1338
and the multipath PR #1296

Basically if we get interrupted by Ctrl-C which is a lot more
likely now when qemu isn't owning the serial console from the
start, we will leak our tmpfiles.

We probably need to install a SIGINT handler but that's a whole
mess that's avoided if we just let the kernel clean up our
resources for us, which is what was happening before the multipath
PR (well, at least for files and not the swtpm tmpdir, but that's
small).

And actually
#1380
does install a SIGINT handler so someone please review that
and we can maybe fix this more after that lands.

I ran out of space in `/tmp` today and it turned out I had
a whole lot of `/tmp/mantle-qemu` files, including some
really big disk images.  This is a combination of changes
from coreos#1338
and the multipath PR coreos#1296

Basically if we get interrupted by Ctrl-C which is a lot more
likely now when qemu isn't owning the serial console from the
start, we will leak our tmpfiles.

We probably need to install a `SIGINT` handler but that's a whole
mess that's avoided if we just let the kernel clean up our
resources for us, which is what was happening before the multipath
PR (well, at least for files and not the swtpm tmpdir, but that's
small).

And actually
coreos#1380
does install a `SIGINT` handler so someone please review that
and we can maybe fix this more after that lands.
Copy link
Contributor

@darkmuggle darkmuggle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cgwalters, darkmuggle

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [cgwalters,darkmuggle]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@darkmuggle
Copy link
Contributor

We probably need to install a SIGINT handler but that's a whole
mess that's avoided if we just let the kernel clean up our
resources for us, which is what was happening before the multipath
PR (well, at least for files and not the swtpm tmpdir, but that's
small).

💯

Comment on lines +774 to +779
if !disk.NbdDisk {
// In the non-multipath/nbd case we can just unlink the disk now
// and avoid leaking space if we get Ctrl-C'd.
os.Remove(disk.dstFileName)
}
disk.dstFileName = ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if !disk.NbdDisk {
// In the non-multipath/nbd case we can just unlink the disk now
// and avoid leaking space if we get Ctrl-C'd.
os.Remove(disk.dstFileName)
}
disk.dstFileName = ""
if !disk.NbdDisk {
// In the non-multipath/nbd case we can just unlink the disk now
// and avoid leaking space if we get Ctrl-C'd.
os.Remove(disk.dstFileName)
// and unset so it doesn't get added to the list of tmpFiles in
// `Exec()`
disk.dstFileName = ""
}

Otherwise I think in the nbd path we end up not cleaning the disk and socket?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK yeah, I'm just going to stick everything in a single tempdir.

@cgwalters cgwalters closed this Apr 24, 2020
cgwalters added a commit to cgwalters/coreos-assembler that referenced this pull request Apr 24, 2020
We had separate code cleaning up:

 - disk snapshots
 - rendered ignition config
 - swtpm

Since the swtpm code was already always making a directory, just
generalize that and use it for everything so we only have one
directory to remove.

Came out of discussion in
coreos#1393
@cgwalters
Copy link
Member Author

#1399

openshift-merge-robot pushed a commit that referenced this pull request Apr 24, 2020
We had separate code cleaning up:

 - disk snapshots
 - rendered ignition config
 - swtpm

Since the swtpm code was already always making a directory, just
generalize that and use it for everything so we only have one
directory to remove.

Came out of discussion in
#1393
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants