In eZDFSFileHandlerMySQLiBackend::_fetch, a file gets copied from the DFS to the local FS to a unique filename and then renamed to the target filename.
When the filesize of the copied file doesn't match the filesize of the DFS file, the copy is performed again until the filesizes match or the maximum number of tries is reached.
When the maximum number of tries is reached, the copy is considered unsuccessful and the temporary file gets deleted.
The Problem is: The name of the temporary file changes with each loop, but gets deleted only after the loop. When the maximum number of tries is set to 3, this means that 2 temp files remain on the file system.
The temporary file should be deleted inside the loop by the dfshandler if the copy was not successful.
A follow up story –
EZP-23254 – will deal with the case when filesize returned are invalid because of FS issues.