[Feature request] Cleaning up temporary convertion folders
Idea
Hi, when container is terminated during conversion its temporary folder is not cleaned up.. you end up with multiple empty folders at the end.. I know it is rather cosmetic and not worth separate PR, but you can have a look next time working on it. Thanks
Where are located these folders ?
/output from the container perspective
These should be removed. Do you see any error from container's log ?
Yes, it cannot delete directory - not empty:
[supervisor ] SIGTERM received, shutting down...
[supervisor ] stopping service 'autovideoconverter'...
[autovideoconverter] rm: cannot remove '/output/.xeqFpP': Directory not empty
[supervisor ] service 'autovideoconverter' exited (got signal SIGTERM).
[supervisor ] stopping service 'app'...
[supervisor ] service 'app' exited (got signal SIGTERM).
[supervisor ] stopping service 'xcompmgr'...
[supervisor ] service 'xcompmgr' exited (got signal SIGTERM).
[supervisor ] stopping service 'openbox'...
[supervisor ] service 'openbox' exited (with status 0).
[supervisor ] stopping service 'nginx'...
[supervisor ] service 'nginx' exited (with status 0).
[supervisor ] stopping service 'xvnc'...
[xvnc ] Thu Oct 9 22:54:43 2025
[xvnc ] ComparingUpdateTracker: 0 pixels in / 0 pixels out
[xvnc ] ComparingUpdateTracker: (1:-nan ratio)
[supervisor ] service 'xvnc' exited (with status 0).
[finish ] executing container finish scripts...
[finish ] all container finish scripts executed.
However it is empty when I check myself:
Looks like the container is being stopped during a conversion. Is this condition required to reproduce the problem ?
Correct.
Hi, when container is terminated during conversion its temporary folder is not cleaned up..
It happens when you have 10 containers doing the conversion and you are pushing update via ansible for some hook scripts. BTW did you notice my comment in the PR for multi-container? Thanks!
Hi @aronmgv How are you imagining the container cleaning up a file when the container is stopped?
The tool would clean up the temp files after conversion is completed.
How are you imagining the logic for deleting temp conversion folders?
Its not possible to check for those directories on startup because another container might actually be USING THAT.
I'd say the solution is quite easy: Dont stop your containers in the middle of them doing stuff. (or do it but then you should not be suprised if they leave a bunch of temp files arround)
Imagine you have 1000 videos in queue for the conversion done by 10 different containers. I am collecting stats from the conversion process in the provided hooks. That information collection needs improvements over time, since not every video file lists its information in the same format.. so when I see some bug I push new update via ansible..
How are you imagining the logic for deleting temp conversion folders?
There is a hook for that. Container receives SIGTERM and can act accordingly.. now for some reason it tries to delete that folder when it is not empty. So couple approaches here:
- firstly clean the interrupted video from that folder and then remove the folder
- force clean the folder
rm -rf
SIGTERM is already handled, which triggers a rm -rf to remove the temporary output folder... I'm not able to reproduce on my side.
Is the output folder a network share ?
Yes, it is a network share via NFS.
I did some adjustments with the latest image. Could you try it to see if it's better ?
I already noticed, will give it a try later today and report. Thanks!
Version 25.10.1
Changes in this release:
Automatic Video Converter: Lock the video file before checking its stability.
This works good now.
Automatic Video Converter: Enhanced cleanup performed during container shutdown.
However for this I see no difference.. when container is restarted during conversion it leaves this e.g. .51yQs3 temporary folder in /output.
Thanks for your time.