Tentacle fails with "File contains corrupted data."

We’re seeing the following exception on a tentacle when deploying a release:

@@@
13:04:16 Verbose | Installing package Otu.96.92.7.0144 from uploaded package cache into C:\Octopus\Applications\Production Proxy\Otu\96.92.7.0144_2
13:04:18 Verbose | Failed receiving Octopus.Tentacle.Orchestration.Deploy.Mutex.AcquiredEvent
| File contains corrupted data.
| System.IO.FileFormatException: File contains corrupted data.
| at MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream.Read(Byte[] buffer, Int32 offset, Int32 count)
| at MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Read(Byte[] buffer, Int32 offset, Int32 count)
| at System.IO.Stream.InternalCopyTo(Stream destination, Int32 bufferSize)
| at Octopus.Shared.Packages.LightweightPackageExtractor.Install(String packageFile, String directory, ILog log, Boolean suppressNestedScriptWarning, Int32& filesExtracted) in y:\work\refs\heads\master\source\Octopus.Shared\Packages\LightweightPackageExtractor.cs:line 56
| at Octopus.Tentacle.Deployment.Packages.PackageInstaller.InstallPackageUsingNuGet(StoredPackage package, String packageInstallationPath, Boolean suppressNestedScriptWarnings, ILog log) in y:\work\refs\heads\master\source\Octopus.Tentacle\Deployment\Packages\PackageInstaller.cs:line 87
| at Octopus.Tentacle.Deployment.Packages.PackageInstaller.Install(StoredPackage package, PackageInstallationOptions options, ILog activityLog) in y:\work\refs\heads\master\source\Octopus.Tentacle\Deployment\Packages\PackageInstaller.cs:line 59
| at Octopus.Tentacle.Orchestration.Deploy.Package.TentaclePackageDeployment.Receive(AcquiredEvent message) in y:\work\refs\heads\master\source\Octopus.Tentacle\Orchestration\Deploy\Package\TentaclePackageDeployment.cs:line 231
| at Pipefish.Actor.OnReceivingTyped[TBody](Message message) in y:\work\3cbe05672d69a231\source\Pipefish\Actor.cs:line 113
| Tentacle version 2.5.5.318
@@@

I’ve checked the source .nupkg in the repo and I am able to unzip it. However after the package has been downloaded to the Packages folder on the Tentacle if I attempt to unzip it, I see CRC errors. (using winrar)

I attempted to manually copy the source .nupkg to the .Tentalc Packages folder (and rename to the GUID one that was already there), but the tentacle seems to always want to download again - despite not having clicked the “Force redownload” button.

As we are still in the process of migrating from Octo 1, we still have an Octo 1 server and tentacle - and that has no problem unpacking the .nupkg…

Am at a loss as to where to go now…

Hi Peter,

Thanks for getting in touch! A couple of things to try here to see why this package is having the issue.
Could you try to deploy again with the Force Redownload option chosen, and see if the package is throwing the same error.
If it does throw the same error could you please use a tool like the following http://winmerge.org/ to compare the original NuGet package and the one that has been uploaded to the tentacle.

Let me know how this works out.
Vanessa

So winmerge crashes when trying to compare them (and nuget package explorer also crashes when trying to open the tentacle copy). I used vbindiff to diff the two packages, and there are a few differences on about 4 bytes out of the 173Mb .nupkg.

Regardless, it seems that forcing re-download got a new copy of the file and as a result it unpacks correctl.

Sigh. I was fully convinced we had tried that yesterday before reporting to you. Amateur mistake.

Cheers
Pete

Hi,
I have a similar issue. Re-download package doesn’t help me. I’ve compared packages on build server and tentacle by WinMerge and found a difference. How should i deal with this? I should mention I have ~30 projects and only 3 of them have this issue. This is the case for two environments, so no dependency on particular tentacle.

Downloading NuGet package My.Service 1.0.228 from feed: 'http://z49os2sut019:8080/httpAuth/app/nuget/v1/FeedService.svc/'
Verbose 15:46:36
Downloaded packages will be stored in: D:\Octopus\PackageCache\feeds-1
Verbose 15:46:36
Finding package (attempt 1 of 5)
Verbose 15:46:38
Found package My.Service version 1.0.228
Verbose 15:46:38
Downloading to: D:\Octopus\PackageCache\feeds-1\My.Service.1.0.228_6BEFF09445F7E049B1748065D3ECE5BB.nupkg
Verbose 15:46:38
A direct download is possible; bypassing the NuGet machine cache
Verbose 15:46:38
Attempt 1 of 5: Unable to download package: File contains corrupted data. File contains corrupted data. System.IO.FileFormatException: File contains corrupted data.13:47:00   Verbose  |   An operation in "Acquire Packages" failed

Thank you in advance!

Anthony

Hi Anthony,

Thanks for getting in touch! Could you tell me a little about the projects and packages by answering my questions below.
Do these three projects always fail in this way?
How big are the packages in the projects?
Does it always happen in these two environments, in particular tentacles (if not could you give a brief idea of the occurrence like Environment A machine 1 (happened 3 times) machine 2 (happened zero times) etc)
Could you try the option to ‘download directly on the tentacle’ in the package step and see what results you get. It will bypass the Download to the Octopus server then push to tentacles and directly download them on the tentacles.

Thanks!
Vanessa

Hi Vanessa,
thank you for your replay!

  • Do these three projects always fail in this way?
    No. For a new build with TeamCity a similar “file corrupted issue” happened only for one and different project. The former three are fine. But this project fails for all environment.
  • How big are the packages in the projects?
    ~ 28Mb
    I’ve changed for this project download option to “Each Tentacle will download the package directly from the NuGet server”. But this didn’t help.

I’m using Octopus Deploy 2.3.3.136.

The full log is attached.

thanks,
Anthony

CorruptedFile.log (25 KB)

Hi Anthony,

This new log is showing us that the NuGet server is rejecting the connection. Its very possible that network issues caused the file in the first instance to corrupt.
Are you able to use Visual Studio and browse to this file and download it? The fact that the timeouts seem to be happening from both the Octopus Server and Tentacle points to the feed server.
You mentioned that you never had issues with your previous projects, were they the same repository/folder/setup ?

Let me know what you find.
Vanessa

Hi Vanessa,

for a couple of next TeamCity builds there were no such errors, but today I have run into this again.
What is noticeable:

  1. For the same build most octopus projects produce release that is deployed fine
  2. Some projects (two now) throw File corrupted exception
  3. All the tame this issue happens projects are different
  4. For each particular time this is release related issue: for the same erroneous project for release say 1.0.27 it is possible to create 1.026 release without error. Manually deletion of 1.0.27 and recreating does not help though. Broken release fails for all environments.
  5. Server and tentacles are in the same LAN and domain.

Log file attached.

looking forward for you help!

Thanks,
Anthony

Hi Anthony,

I can’t see the log file, can you attach again please!

Vanessa

Hi Vanessa, the file is attached. Thanks!

CorruptedFile2.log (4 KB)

Hi Anthony,

In your first post you mentioned: I’m using Octopus Deploy 2.3.3.136.
But in your logs Im seeing: Octopus.Server version 2.5.10.567

Can you clarify if you upgraded since the first post, and if your tentacle and server are on the same version.

Vanessa

Hi Vanessa,

the server was upgraded and I wasn’t informed, unfortunately. But the issue persists anyway.

looking forward for you help!

thanks,
Anthony

Hi Anthony,

Has the Team City plugin also been updated? Can you let me know what version that is running.
The logs are still pointing to a connection error. As previously asked are you able to browse your NuGet feed via Visual Studio and successfully download he package?

This is what I am seeing in the logs:
System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

Vanessa

Hi Vanessa,

if you mean Octopus Deploy integration plug-in current version is 2.5.4.35. But I start Octopus deploy without this trigger, “manually”, actually by Octopus REST API.

Thanks,
Anton

Hi Anthony,

Could you please do the following and tell us what results you get.

  1. Download and install http://npe.codeplex.com/ Nuget Package Explorer, if you do not have it installed already
  2. Select “open a package from online feed” and enter your feed
  3. download that package from the feed and open it.

Did you have any troubles with this process? Was the feed available and did the package download correctly?

Vanessa