Prevent temp files in VolumeWriterBase from being deleted prematurely.
The fix is hacky and the root cause should be investigated properly.
This commit is contained in:
@@ -106,7 +106,9 @@ namespace Duplicati.Library.Main.Operation.Backup
|
||||
{
|
||||
// If we have collected data, merge all pending volumes into a single volume
|
||||
if (blockvolume != null && blockvolume.SourceSize > 0)
|
||||
{
|
||||
await self.SpillPickup.WriteAsync(new VolumeUploadRequest(blockvolume, true));
|
||||
}
|
||||
}
|
||||
|
||||
throw;
|
||||
|
||||
@@ -53,6 +53,9 @@ namespace Duplicati.Library.Main.Volumes
|
||||
else
|
||||
m_localfile = new Library.Utility.TempFile();
|
||||
|
||||
// TODO(danstahr): This is a hack! Figure out why the file is being disposed of prematurely.
|
||||
m_localfile.Protected = true;
|
||||
|
||||
ResetRemoteFilename(options, timestamp);
|
||||
m_compression = DynamicLoader.CompressionLoader.GetModule(options.CompressionModule, m_localfile, options.RawOptions);
|
||||
|
||||
@@ -77,6 +80,8 @@ namespace Duplicati.Library.Main.Volumes
|
||||
try { m_compression.Dispose(); }
|
||||
finally { m_compression = null; }
|
||||
|
||||
m_localfile.Protected = false;
|
||||
|
||||
if (m_localfile != null)
|
||||
try { m_localfile.Dispose(); }
|
||||
finally { m_localfile = null; }
|
||||
|
||||
@@ -34,10 +34,10 @@ namespace Duplicati.Library.Utility
|
||||
public static string APPLICATION_PREFIX = Utility.getEntryAssembly().FullName.Substring(0, 3).ToLower() + "-";
|
||||
|
||||
private string m_path;
|
||||
private bool m_protect;
|
||||
|
||||
private bool m_protect;
|
||||
|
||||
#if DEBUG
|
||||
//In debug mode, we track the creation of temporary files, and encode the generating method into the name
|
||||
//In debug mode, we track the creation of temporary files, and encode the generating method into the name
|
||||
private static object m_lock = new object();
|
||||
private static Dictionary<string, System.Diagnostics.StackTrace> m_fileTrace = new Dictionary<string, System.Diagnostics.StackTrace>();
|
||||
|
||||
@@ -72,7 +72,6 @@ namespace Duplicati.Library.Utility
|
||||
m_fileTrace.Add(s, st);
|
||||
return s;
|
||||
}
|
||||
|
||||
#else
|
||||
private static string GenerateUniqueName()
|
||||
{
|
||||
@@ -84,7 +83,7 @@ namespace Duplicati.Library.Utility
|
||||
/// Gets all temporary files found in the current tempdir, that matches the application prefix
|
||||
/// </summary>
|
||||
/// <returns>The application temp files.</returns>
|
||||
public static IEnumerable<string> GetApplicationTempFiles()
|
||||
private static IEnumerable<string> GetApplicationTempFiles()
|
||||
{
|
||||
return System.IO.Directory.GetFiles(TempFolder.SystemTempPath, APPLICATION_PREFIX + "*");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user