1

When I try to upload an archive to Rackspace Cloudfiles with openstacknetsdk, I get a System.Net.Sockets.SocketException, uploading the same file with CreateObjectFromFile works perfectly.

Sample code:

var rackspaceIdentity = new CloudIdentity { APIKey = "xxx", Username = "xxx" };
var rackspaceProvider = new CloudFilesProvider(rackspaceIdentity);

const string bz2File = @"C:\Users\Jan\AppData\Local\Temp\tmp1B64.tmp";

var containerName = DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture);
rackspaceProvider.CreateContainer(containerName);
rackspaceProvider.EnableCDNOnContainer(containerName, 3600);

Console.WriteLine("Pre CreateObjectFromFile");
rackspaceProvider.CreateObjectFromFile(containerName, bz2File, progressUpdated: x => Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)));
Console.WriteLine("Post CreateObjectFromFile");

var containerName2 = DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture);
rackspaceProvider.CreateContainer(containerName2);
rackspaceProvider.EnableCDNOnContainer(containerName2, 3600);

Console.WriteLine("Pre ExtractArchiveFromFile");
rackspaceProvider.ExtractArchiveFromFile(bz2File, containerName2, ArchiveFormat.TarBz2, progressUpdated: x => Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)));
Console.WriteLine("Post ExtractArchiveFromFile");

Exception details:

System.IO.IOException was unhandled
  _HResult=-2146232800
  _message=Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.
  HResult=-2146232800
  IsTransient=false
  Message=Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.
  Source=System
  StackTrace:
       at System.Net.Sockets.NetworkStream.MultipleWrite(BufferOffsetSize[] buffers)
       at System.Net.Security._SslStream.StartWriting(SplitWritesState splitWrite, SplitWriteAsyncProtocolRequest asyncRequest)
       at System.Net.Security._SslStream.ProcessWrite(BufferOffsetSize[] buffers, SplitWriteAsyncProtocolRequest asyncRequest)
       at System.Net.TlsStream.MultipleWrite(BufferOffsetSize[] buffers)
       at System.Net.PooledStream.MultipleWrite(BufferOffsetSize[] buffers)
       at System.Net.ConnectStream.InternalWrite(Boolean async, Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
       at System.Net.ConnectStream.Write(Byte[] buffer, Int32 offset, Int32 size)
       at net.openstack.Providers.Rackspace.ExtendedJsonRestServices.<>c__DisplayClass1.<Stream>b__0(HttpWebRequest req)
       at JSIStudios.SimpleRESTServices.Client.RestServiceBase.<>c__DisplayClass7.<ExecuteRequest>b__6()
       at JSIStudios.SimpleRESTServices.Client.RequestRetryLogic.Execute(Func`1 callback, IEnumerable`1 non200SuccessCodes, Int32 retryCount, Nullable`1 retryDelay)
       at JSIStudios.SimpleRESTServices.Client.RestServiceBase.ExecuteRequest(Uri url, HttpMethod method, Func`3 responseBuilderCallback, Dictionary`2 headers, Dictionary`2 queryStringParameters, RequestSettings settings, Func`2 executeCallback)
       at net.openstack.Providers.Rackspace.ExtendedJsonRestServices.Stream(Uri url, HttpMethod method, Func`3 responseBuilderCallback, Stream content, Int32 bufferSize, Int64 maxReadLength, Dictionary`2 headers, Dictionary`2 queryStringParameters, RequestSettings settings, Action`1 progressUpdated)
       at JSIStudios.SimpleRESTServices.Client.RestServiceBase.Stream(Uri url, HttpMethod method, Stream content, Int32 bufferSize, Int64 maxReadLength, Dictionary`2 headers, Dictionary`2 queryStringParameters, RequestSettings settings, Action`1 progressUpdated)
       at net.openstack.Providers.Rackspace.ProviderBase`1.StreamRESTRequest(CloudIdentity identity, Uri absoluteUri, HttpMethod method, Stream stream, Int32 chunkSize, Int64 maxReadLength, Dictionary`2 queryStringParameter, Dictionary`2 headers, Boolean isRetry, RequestSettings requestSettings, Action`1 progressUpdated)
       at net.openstack.Providers.Rackspace.CloudFilesProvider.ExtractArchive(Stream stream, String uploadPath, ArchiveFormat archiveFormat, String contentType, Int32 chunkSize, Dictionary`2 headers, String region, Action`1 progressUpdated, Boolean useInternalUrl, CloudIdentity identity)
       at net.openstack.Providers.Rackspace.CloudFilesProvider.ExtractArchiveFromFile(String filePath, String uploadPath, ArchiveFormat archiveFormat, String contentType, Int32 chunkSize, Dictionary`2 headers, String region, Action`1 progressUpdated, Boolean useInternalUrl, CloudIdentity identity)
       at RackspaceDriver.Program.Main() in c:\Users\Jan\Documents\Visual Studio Projects\RackspaceDriver\RackspaceDriver\Program.cs:line 31
  InnerException: System.Net.Sockets.SocketException
       _HResult=-2147467259
       _message=An existing connection was forcibly closed by the remote host
       HResult=-2147467259
       IsTransient=false
       Message=An existing connection was forcibly closed by the remote host
       Source=System
       ErrorCode=10054
       NativeErrorCode=10054
       StackTrace:
            at System.Net.Sockets.Socket.MultipleSend(BufferOffsetSize[] buffers, SocketFlags socketFlags)
            at System.Net.Sockets.NetworkStream.MultipleWrite(BufferOffsetSize[] buffers)
       InnerException: 

The bz2 file is +-170MB.

When looking at the code I don't see any significant differences...

  • Newtonsoft.Json 5.0.8
  • openstack.net 1.3.3.0
  • SimpleRESTServices 1.3.0.1
janv8000
  • 1,569
  • 2
  • 19
  • 33
  • Have you checked for any other specific information on the [SocketException](http://msdn.microsoft.com/en-us/library/system.net.sockets.socketexception(v=vs.110).aspx)? There are several properties on it that may be helpful in figuring out what's going on. You can edit your question to include that information. You might also check if there's an `InnerException`. – Jeff B Oct 30 '14 at 16:30
  • I added the exception details. Using curl I get `curl: (56) SSL read: error:00000000:lib(0):func(0):reason(0), errno 113`, so it might not be .NET/sdk related ... – janv8000 Oct 31 '14 at 08:34
  • Hmm, I've seen "An existing connection was forcibly closed by the remote host" when one of our .NET applications hosted in IIS throws an uncaught exception on a background thread. It'll take the whole app-pool out. – Jeff B Oct 31 '14 at 13:09

0 Answers0