Couchbase View Query Error (underlying connection was closed)

I have been experiencing problems with Couchbase view where if I request a large amount of keys (around 1000) I immediately get the error “The underlying connection was closed: An unexpected error occurred on a receive”. The inner exception message is “Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.” I tried increase the timeout of the view query but it appears to have no effect. It does work if i reduce the amount of requested keys down to like 500 or so. I am using the latest SDK 2.2.1 Does this mean there is a limit on the amount of requested keys or is there a problem else where?

Thanks,
Andrew

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
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.GetResponse()
   at Couchbase.Views.ViewClient.Execute[T](IViewQueryable query)

Here is the full exception (I’m using Couchbase 3.1.3). Do you have any idea as to why this is occuring @jmorris?

Thanks.

You should experiment with the view timeout as well as the connection timeout.

Also, have you looked on the server side to see why it closed the connection?

@acac999

I believe @jmorris is currently out of the office, I think he’s going to be back next week.

I’d also recommend looking at your network topology. The error you’re getting looks like the TCP connection was closed while in progress. This could have been done by the server, but it also could have been done somewhere in the network stack on the server or by the network infrastructure. Perhaps a maximum TCP session time or a short TCP inactivity timer somewhere along the line.