You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using twoliter, my root volume became full due to /tmp usage. It turns out that there were many .tmp directories, each with their own unpacked copy of krane. It seems the twoliter is not properly cleaning up its krane binaries on exit.
After investigating, I believe it's due to the fact that we have a public static reference to a singular Krane struct that we use in twoliter (See here).
tempfile will (almost) never fail to cleanup temporary resources. However TempDir and NamedTempFile will fail if their destructors don’t run. This is because tempfile relies on the OS to cleanup the underlying file, while TempDir and NamedTempFile rely on rust destructors to do so. Destructors may fail to run if the process exits through an unhandled signal interrupt (like SIGINT), or if the instance is declared statically (like with lazy_static), among other possible reasons.
That documentation also says:
When choosing between the temporary file variants, prefer tempfile unless you either need to know the file’s path or to be able to persist it.
We do need to know the filepath to execute the binary that we write and thus must use one of the named options.
So rather than relying on a KRANE static, I think we need to rework the krane-bundle crate and users to create their own instance of Krane that they are guaranteed to drop.
The text was updated successfully, but these errors were encountered:
Issue Description
When using
twoliter
, my root volume became full due to/tmp
usage. It turns out that there were many.tmp
directories, each with their own unpacked copy ofkrane
. It seems thetwoliter
is not properly cleaning up itskrane
binaries on exit.After investigating, I believe it's due to the fact that we have a public static reference to a singular
Krane
struct that we use intwoliter
(See here).The
Krane
struct usesTempDir
to store its binary; however, the tempfile documentation calls out that this will result in resource leaking -- Rust must not be calling theDrop
implementation for this static.That documentation also says:
We do need to know the filepath to execute the binary that we write and thus must use one of the named options.
So rather than relying on a
KRANE
static, I think we need to rework thekrane-bundle
crate and users to create their own instance ofKrane
that they are guaranteed to drop.The text was updated successfully, but these errors were encountered: