I'm losing files in /tmp on current Ubuntu (22.04.2), possibly related to virtualisation. Any insights appreciated. This is not a normal cleanup; the file is lost immediately.
I have two systems: a remote VPS, and a local staging system, both running the same software. On both systems, /tmp is not a tmpfs; it's part of the LVM volume group mounted at /.
Apache runs program1 and program2 immediately after each other:
program1creates a new subdirectory under/tmp, with 2 files:file1(a Python source file) andfile2(the output offile1). If debug is enabled,file1is retained; otherwise, it it deleted after creatingfile2(with a C libraryremove)program2returnsfile2to the client
This all works as expected on the staging system. If debug is enabled, the new /tmp/xxx directory is still on the filesystem, and contains both file1 and file2. If debug isn't enabled, it contains only file2.
On the VPS:
- if debug is not enabled, everything works, but there's nothing left under
/tmp - if debug is enabled,
program2fails, reporting thatfile2doesn't exist
I have 'fixed' the code by removing the C lib remove, so that file1 is always retained, but I don't understand what's going on - it appears that the file remove has somewhere triggered a remove of the entire directory.