kamsar / Dianoga

An automatic image optimizer for the Sitecore media library.
Other
104 stars 45 forks source link

jpeg62.dll is causing locked files #12

Closed michaelbailey closed 8 years ago

michaelbailey commented 8 years ago

We have a similar issue to #1, but related to jpeg62.dll locking files.

Deployments from Octopus Deploy fail with this message:

Error from Octopus Deploy: Copying package contents to '\Website' 18:41:52Error System.IO.IOException: The process cannot access the file '\Website\Dianoga Tools\libjpeg\jpeg62.dll' because it is being used by another process. 18:41:52Error at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 18:41:52Error at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost) 18:41:52Error at Calamari.Integration.FileSystem.CalamariPhysicalFileSystem.CopyFile(String sourceFile, String targetFile) in Y:\work\14ffc968155e4956\source\Calamari\Integration\FileSystem\CalamariPhysicalFileSystem.cs:line 453 18:41:52Error at Calamari.Integration.FileSystem.CalamariPhysicalFileSystem.CopyDirectory(String sourceDirectory, String targetDirectory, CancellationToken cancel) in Y:\work\14ffc968155e4956\source\Calamari\Integration\FileSystem\CalamariPhysicalFileSystem.cs:line 416 18:41:52Error at Calamari.Integration.FileSystem.CalamariPhysicalFileSystem.CopyDirectory(String sourceDirectory, String targetDirectory, CancellationToken cancel) in Y:\work\14ffc968155e4956\source\Calamari\Integration\FileSystem\CalamariPhysicalFileSystem.cs:line 423 18:41:52Error at Calamari.Integration.FileSystem.CalamariPhysicalFileSystem.CopyDirectory(String sourceDirectory, String targetDirectory, CancellationToken cancel) in Y:\work\14ffc968155e4956\source\Calamari\Integration\FileSystem\CalamariPhysicalFileSystem.cs:line 423 18:41:52Error at Calamari.Integration.FileSystem.CalamariPhysicalFileSystem.CopyDirectory(String sourceDirectory, String targetDirectory) in Y:\work\14ffc968155e4956\source\Calamari\Integration\FileSystem\CalamariPhysicalFileSystem.cs:line 395 18:41:52Error at Calamari.Deployment.Conventions.CopyPackageToCustomInstallationDirectoryConvention.Install(RunningDeployment deployment) in Y:\work\14ffc968155e4956\source\Calamari\Deployment\Conventions\CopyPackageToCustomInstallationDirectoryConvention.cs:line 40 18:41:52Error at Calamari.Deployment.ConventionProcessor.RunInstallConventions() in Y:\work\14ffc968155e4956\source\Calamari\Deployment\ConventionProcessor.cs:line 60 18:41:52Error at Calamari.Deployment.ConventionProcessor.RunConventions() in Y:\work\14ffc968155e4956\source\Calamari\Deployment\ConventionProcessor.cs:line 28 18:41:52Error Running rollback conventions... 18:41:52Error System.IO.IOException: The process cannot access the file '\Website\Dianoga Tools\libjpeg\jpeg62.dll' because it is being used by another process.

The error occurs even when no images should be getting resized. We are using v2.0.2.

kamsar commented 8 years ago

libjpeg is not P/Invoked from C# like in #1 so this must be something else. I've done a lot of deployments (though none with Octopus) to production with Dianoga and haven't run into this one.

Is Octopus overwriting all files even unchanged?

You might also try Dianoga 3.0RC1, which includes a lot of enhancements to the way tools are invoked such as showing the tool output when an error occurs. It's also using a newer version of mozjpeg that is supposed to be better for the web, that might also fix your locking issue.

jpgcode commented 8 years ago

I'm getting the same error running Teamcity build.

error MSB3027: Could not copy "..\Dianoga Tools\libjpeg\jpeg62.dll" to "..\Dianoga Tools\libjpeg\jpeg62.dll". Exceeded retry count of 10. Failed. 
error MSB3021: Unable to copy file "..\Dianoga Tools\libjpeg\jpeg62.dll" to "..Dianoga Tools\libjpeg\jpeg62.dll". The process cannot access the file '..\Dianoga Tools\libjpeg\jpeg62.dll' because it is being used by another process. 

error MSB3027: Could not copy "...\Dianoga Tools\libjpeg\jpegtran.exe" to "..\Dianoga Tools\libjpeg\jpegtran.exe". Exceeded retry count of 10. Failed. 
error MSB3021: Unable to copy file "..\Dianoga Tools\libjpeg\jpegtran.exe" to "..\Dianoga Tools\libjpeg\jpegtran.exe". The process cannot access the file '..\Dianoga Tools\libjpeg\jpegtran.exe' because it is being used by another process. 
kamsar commented 8 years ago

If you're getting this error, please use 3.0. It loads assemblies in a significantly improved fashion that should avoid this issue.