Open naglis opened 3 months ago
Huh, very interesting. We are very close to ditching the temporary directory (see https://github.com/freedomofpress/dangerzone/pull/748) altogether, so this issue will be implicitly solved. Let's keep it open till then.
Steps to reproduce:
I am able to reproduce it pretty much every time both via installed package (Arch Linux) and when running from source via
dev_scripts
. I can also reproduce it if running via dangerzone-cli and then interrupting (Ctrl+C) the process while it is converting pages to pixels.After dangerzone exits, the
pixels
subdirectory in the temporary directory created on the host by dangerzone will contain*.{rgb,width,height}
files of the pages created after the "Abort conversions" button was pressed.My speculation on what happens is that
tempfile.TemporaryDirectory
cleanup is invoked while pixel files are still being produced. The cleanup function usesshutil.rmtree
which first deletes the files that exist in thepixels
subdirectory and then tries to delete the subdirectory itself, however, since the doc-to-pixel conversion is still running on another thread, it creates new files in thepixels
subdirectory in the meantime sincermtree
last checked it is empty.Perhaps some synchronization is needed between the threads after it is clear that dangerzone is exiting to ensure that new files are not being created () in the temporary directory and the
TemporaryDirectory
cleanup can run cleanly? :thinking: