When the application exits the extracted nested jars (declared in requiresUnpack) from executable jar are not removed from java.io.tmpdir directory.
Spring Boot version 2.2.5.RELEASE
Comment From: wilkinsona
Thanks for the report. Is this causing a problem for you? They are intentionally written to the temp directory so that the operating system can clean them up automatically. For Boot to delete them itself, we'd have to use something like deleteOnExit
. This has the notable limitation that it isn't guaranteed to run. As a result, you'd still need to configure or rely upon an external clean-up mechanism anyway.
Comment From: maniek45
Thanks for quick response. First I was not aware that this is how it works. Maybe some note in the documentation would be helpful. The problem I had was that the entire disk space has been taken by these extracted nested jars when application could not start and linux systemd tried to restart it indefinitely. If this not pose other issues then I think deleteOnExit would be a solution (but as you noticed not always guaranteed to work).
Comment From: wilkinsona
We already document the use of the temp directory and offer some advice about how the OS should be configured so that the jars are deleted at the right time, i.e. not while the application is running. I'm not sure that there's much more that we can do here. As I said above, deleteOnExit
isn't a solution as it isn't guaranteed to run. Thanks anyway for the suggestions.