Stack overflow on downloading nuget package

We received a stack overflow during the download package phase, we are running 3.2.11 server / tentacles and 3.1.23 of calamari. Not sure if this is something you have encountered before or not. This is our first occurrence that I have seen, but wanted to bring it up to someones attention.

The remote script failed with exit code -1073741571
 Download package <package> <version> from <feed>
13:53:41Verbose Octopus Deploy: Calamari version 3.1.23+Branch.master.Sha.c1c6ab8aed259e94b1ce58041274eca0d2046914
13:53:41Verbose Name                           Value                                           
13:53:41Verbose ----                           -----                                           
13:53:41Verbose PSVersion                      4.0                                             
13:53:41Verbose WSManStackVersion              3.0                                             
13:53:41Verbose SerializationVersion           1.1.0.1                                         
13:53:41Verbose CLRVersion                     4.0.30319.36311                                 
13:53:41Verbose BuildVersion                   6.3.9600.16406                                  
13:53:41Verbose PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}                            
13:53:41Verbose PSRemotingProtocolVersion      2.2                                             
13:53:41Verbose Octopus Deploy: Calamari version 3.1.23+Branch.master.Sha.c1c6ab8aed259e94b1ce58041274eca0d2046914
13:53:41Verbose Checking package cache for package <package> <version>
13:53:41Info Downloading NuGet package <package> <version> from feed: '<feed>'
13:53:41Verbose Downloaded package will be stored in: 'D:\Octopus\Files\feeds-octopus-packages'
13:53:41Verbose Finding package (attempt 1 of 5)
13:53:41Verbose Found package <package> version <version>
13:53:41Verbose Downloading to: D:\Octopus\Files\feeds-octopus-packages\<package>.<version>_62B69C33351A2449ABCAD790DD3D384A.nupkg
13:53:41Verbose A direct download is possible; bypassing the NuGet machine cache
13:54:43Error Process is terminated due to StackOverflowException.

Hi Brent,
Thanks for the heads up with this exception. Looking through the code it looks like it might have happened within the nuget.core codebase where it tries to retrieve the file from a remote repository. Could you provide any further server-side logs of this event? Perhaps details about the repository itself.
Any extra information means we may be able to mitigate such failures in the future.
Thanks again,
Robert

Rob,

So I looked in the tentacle logs for the server and for the octopus deploy server and I do not see anything weird there regarding the stack overflow error, however I do see some weird items which may or may not have something to do with it. There seems to be a bunch of network connections during this time.

2016-01-14 13:52:57.3535   1360  INFO  <server> 1360  Opening a new connection
2016-01-14 13:52:57.3691   1008  INFO  <server> 1008  Opening a new connection
2016-01-14 13:52:57.3691    479  INFO  <server>  479  Opening a new connection
2016-01-14 13:52:57.3691   1360  INFO  <server> 1360  Performing TLS handshake
2016-01-14 13:52:57.3691   1008  INFO  <server> 1008  Performing TLS handshake
2016-01-14 13:52:57.3691    479  INFO  <server>  479  Performing TLS handshake
2016-01-14 13:52:57.3847   1761  INFO  <server> 1761  Opening a new connection
2016-01-14 13:52:57.3847   1761  INFO  <server> 1761  Performing TLS handshake
2016-01-14 13:52:57.4939    350  INFO  <server>  350  Opening a new connection
2016-01-14 13:52:57.4939    868  INFO  <server>  868  Opening a new connection
2016-01-14 13:52:57.4939   1287  INFO  <server> 1287  Opening a new connection
2016-01-14 13:52:57.4939    868  INFO  <server>  868  Performing TLS handshake
2016-01-14 13:52:57.4939   1287  INFO  <server> 1287  Performing TLS handshake
2016-01-14 13:52:57.4939    350  INFO  <server>  350  Performing TLS handshake
2016-01-14 13:52:57.6031     44  INFO  <server>   44  Opening a new connection
2016-01-14 13:52:57.6031     44  INFO  <server>   44  Performing TLS handshake
2016-01-14 13:52:57.7123   1573  INFO  <server> 1573  Opening a new connection
2016-01-14 13:52:57.7123   1573  INFO  <server> 1573  Performing TLS handshake
2016-01-14 13:52:58.3831   1360  INFO  <server> 1360  Secure connection established. Server at [::ffff:<ip>]:10933 identified by thumbprint: <thumprint>, using protocol Tls12
2016-01-14 13:52:59.3816   1008  INFO  <server> 1008  Secure connection established. Server at [::ffff:<ip>]:10933 identified by thumbprint: <thumprint>, using protocol Tls12
2016-01-14 13:53:00.5204   1587  INFO  System dashboard loaded in: 417.9939ms
2016-01-14 13:53:03.8901    479  INFO  <server>  479  Secure connection established. Server at [::ffff:<ip>]:10933 identified by thumbprint: <thumprint>, using protocol Tls12
2016-01-14 13:53:05.6530   1761  INFO  <server> 1761  Secure connection established. Server at [::ffff:<ip>]:10933 identified by thumbprint: <thumprint>, using protocol Tls12
2016-01-14 13:53:06.2458   1587  INFO  System dashboard loaded in: 510.664ms
2016-01-14 13:53:06.9010    350  INFO  <server>  350  Secure connection established. Server at [::ffff:<ip>]:10933 identified by thumbprint: <thumprint>, using protocol Tls12
2016-01-14 13:53:06.9322    868  INFO  <server>  868  Secure connection established. Server at [::ffff:<ip>]:10933 identified by thumbprint: <thumprint>, using protocol Tls12
2016-01-14 13:53:07.9306   1287  INFO  <server> 1287  Secure connection established. Server at [::ffff:<ip>]:10933 identified by thumbprint: <thumprint>, using protocol Tls12
2016-01-14 13:53:08.8979     44  INFO  <server>   44  Secure connection established. Server at [::ffff:<ip>]:10933 identified by thumbprint: <thumprint>, using protocol Tls12
2016-01-14 13:53:09.9275   1573  INFO  <server> 1573  Secure connection established. Server at [::ffff:<ip>]:10933 identified by thumbprint: <thumprint>, using protocol Tls12
2016-01-14 13:53:12.2364   1761  INFO  <server> 1761  Opening a new connection
2016-01-14 13:53:12.2364   1761  INFO  <server> 1761  Performing TLS handshake
2016-01-14 13:53:12.4236   1169  INFO  <server> 1169  Opening a new connection
2016-01-14 13:53:12.4236   1169  INFO  <server> 1169  Performing TLS handshake
2016-01-14 13:53:12.4860    868  INFO  <server>  868  Opening a new connection
2016-01-14 13:53:12.4860    868  INFO  <server>  868  Performing TLS handshake
2016-01-14 13:53:12.7200   1587  INFO  System dashboard loaded in: 893.5904ms
2016-01-14 13:53:12.7980   1008  INFO  <server> 1008  Opening a new connection
2016-01-14 13:53:12.7980   1008  INFO  <server> 1008  Performing TLS handshake

Hi Brent,
Judging from the port it sounds like just the standard Halibut logs between tentacle and server. I think it can sometimes look a bit chatty like this when a connection drops and is has to reconnect. Typically it shouldn’t cause an issue. Could you please let us know again if this NuGet exception comes up. If it becomes a trend it will probably require a little more investigation but it does sound like NuGet was just playing up.
Cheers

Robert