Connection forcibly closed by the remote host

865 views
Skip to first unread message

Nathan Gloyn

unread,
Dec 11, 2014, 7:46:18 AM12/11/14
to rav...@googlegroups.com
In system currently working on we have operations where we do the following:
  • Open session
  • Stream documents based on a query
For each streamed document
    • Open session
    • Make changes to the document
    • Save changes
  • At end of stream dispose session (no changes to save)
We aren't using Bulk methods as each document can have its own unique values which may or may not need to be altered and we have to record what changes take place for each document.

This has been working but testing with a larger number of documents being streamed I am getting the following error on a regular basis:

Exception Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

An initial change that was made was to handle the ConfigureRequest event and set the following:

            DocumentStore.JsonRequestFactory.ConfigureRequest += (sender, e) => {
               
var httpWebRequest = ((HttpWebRequest)e.Request);
                httpWebRequest
.UnsafeAuthenticatedConnectionSharing = true;
                httpWebRequest
.PreAuthenticate = true;
           
};

Doing this resolved the issue but as the number of documents increased the problem has come back.

I haven't found a trigger point yet as to number of documents or amount of time elapsed but I believe it may be machine dependent i.e. spec of machine determines when this occurs.

The build & version of Raven I am working with is build 2916, Version 2.5.0, and this is running as service accessed by normal Raven Client via Http.

Any thoughts on what could cause the error and if there is any way to resolve this?

Oren Eini (Ayende Rahien)

unread,
Dec 11, 2014, 8:42:07 AM12/11/14
to ravendb
Are you running in IIS? 
It is possible that you are hitting the request timeout in IIS, which shut down the request.

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Arnold Wolfe

unread,
Dec 11, 2014, 8:57:12 AM12/11/14
to rav...@googlegroups.com
This is running in debug and service mode. Is there a way to increase the timeout?

Oren Eini (Ayende Rahien)

unread,
Dec 11, 2014, 9:13:08 AM12/11/14
to ravendb
There shouldn't be a timeout on running as service.
Do you run this remotely? Is it possible that a firewall is in the way?

Nathan Gloyn

unread,
Dec 11, 2014, 9:19:15 AM12/11/14
to rav...@googlegroups.com
Nope running locally, no firewall.

Oren Eini (Ayende Rahien)

unread,
Dec 11, 2014, 9:21:08 AM12/11/14
to ravendb
Try running this through Fiddler, maybe it can tell us more.
Message has been deleted

Nathan Gloyn

unread,
Dec 11, 2014, 10:22:21 AM12/11/14
to rav...@googlegroups.com
Ok, I've run it through fiddler and the processing of the documents works.

If I take fiddler away and run it the processing of the documents fails, its as if the client is going too fast.

Oren Eini (Ayende Rahien)

unread,
Dec 12, 2014, 2:47:14 AM12/12/14
to ravendb
Wait!
What build are you using this on?

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


On Thu, Dec 11, 2014 at 5:22 PM, Nathan Gloyn <nathans...@gmail.com> wrote:
Ok, I've run it through fiddler and the processing of the documents works.

If I take fiddler away and run it the processing of the documents fails, its as if the client is going too fast.

--

Nathan Gloyn

unread,
Dec 12, 2014, 3:34:56 AM12/12/14
to rav...@googlegroups.com
Using build 2916, Version 2.5.0

Oren Eini (Ayende Rahien)

unread,
Dec 12, 2014, 3:36:03 AM12/12/14
to ravendb
Can you update to the latest build for both smuggler exe and the server?

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


On Fri, Dec 12, 2014 at 10:34 AM, Nathan Gloyn <nathans...@gmail.com> wrote:
Using build 2916, Version 2.5.0

Nathan Gloyn

unread,
Dec 12, 2014, 5:16:47 AM12/12/14
to rav...@googlegroups.com
I updated to Build 2945, Version 2.5.0 but the problem is still there.

I looked to try Version 3 but an error is thrown when trying to load our custom plugins, so will need to see if can recompile those but not able to do that right now.

Oren Eini (Ayende Rahien)

unread,
Dec 12, 2014, 5:50:22 AM12/12/14
to ravendb
Can you check the netstat details? Maybe we can try to figure out what is going on that way

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


On Fri, Dec 12, 2014 at 12:16 PM, Nathan Gloyn <nathans...@gmail.com> wrote:
I updated to Build 2945, Version 2.5.0 but the problem is still there.

I looked to try Version 3 but an error is thrown when trying to load our custom plugins, so will need to see if can recompile those but not able to do that right now.

--

Asbjørn Ulsberg

unread,
Dec 16, 2014, 3:08:45 AM12/16/14
to rav...@googlegroups.com
This looks like the issues we have had recently related to deactivation of SSL3. If you have any code within the same AppDomain doing this:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;

That will affect all connections from (and to) the same AppDomain, forcing it to SSL3. If SSL3 has been deactivated (as it should) on the server or client, the connection will be forcibly closed. Might this be the problem?

-- 
Asbjørn Ulsberg          -=|=-         asb...@ulsberg.no
«He's a loathsome offensive brute, yet I can't look away»
--

Nathan Gloyn

unread,
Jan 12, 2015, 10:56:35 AM1/12/15
to rav...@googlegroups.com
Just an update.

We altered the code and removed streaming, instead moved to a batched approach which appears to have resolved the problem.

I noticed the post about Subscriptions so may investigate if this would work for our use case.
Reply all
Reply to author
Forward
0 new messages