Hi,
I've been having the same issues. After stripping a lot of code out . got to the conclusion that it was the streaming that fails. The minimum code I can reproduce it with is as follows. It generates 5000 documents and streams them out with a thread.sleep of 100ms for each item (to simulate processing). It crashes after ca. 2 minutes with An existing connection was forcibly closed by the remote host.
using System.Linq;
using System.Threading;
using NLog;
using Raven.Client;
using Raven.Client.Document;
namespace NatWa.MidOffice
{
public static class Program
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public static void Main(string[] arguments)
{
{
documentStore.Initialize();
documentStore.DatabaseCommands.GlobalAdmin.DeleteDatabase("test", true);
documentStore.DatabaseCommands.GlobalAdmin.EnsureDatabaseExists("test");
using (IDocumentSession session = documentStore.OpenSession())
{
for (int i = 1; i < 5000; i++)
{
session.Store(new
{
a = i,
b = new string(Enumerable.Range(0, 5000).Select(i2 => 'a').ToArray()) // generate a long string to have some body
}, "thingy/" + i);
}
session.SaveChanges();
}
using (var documentSession = documentStore.OpenSession())
{
var enumerator = documentSession.Advanced.Stream<dynamic>("thingy/");
int counter = 0;
while (enumerator.MoveNext())
{
Logger.Info("{0} ", counter++);
Thread.Sleep(100);
}
}
}
}
}
}
I have a wireshark dump (using a different database because wireshark don't do localhost, but with localhost it fails the same)
at 31748 20:33:00.54626 I see the 200 response from the server (IP .10) to the client (IP .1)
at 31821 20:34:58.36879 I see three RST's
I've also attached the logfile from the code above (with 2 hours timezone difference).
around 20:33:00 (when we see the 200 in wireshark) the code is processing streaming item number 12
only around the processing of item 1194
so it looks like it receives all the data very early (after a couple of seconds) and crashes way after it already has received all data and received a 200 for it.
It looks to me similar with the opening post. Hope this helps.
cheers,
Arno