Error while calling Flush() on bucket that has Flush enabled

When our automated test tries to clear Bucket with following code

public static void ClearBucket(string bucketName)
{
     using (var manager = ClusterHelper.GetBucket(bucketName).CreateManager())
     {
         manager.Flush();
      }
}

it fails with the following:

System.AggregateException : One or more errors occurred.
----> System.Net.Http.HttpRequestException : An error occurred while sending the request.
----> 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.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at Couchbase.Management.BucketManager.Flush()
...

All buckets in question has Flush setting enabled.

@hryh -

Which CB version and SDK version? Can you use fiddler to capture the HTTP traffic when Flush() is called and post it?

Thanks,

Jeff

Hi, thank you for response. Will try to capture traffic little bit later.

But now I have another piece of information regarding this: the call to Flush method is failing when server is configured using 127.0.0.1 IP, but when configuration is changed to be machine name instead of IP the call to Flush starts to work.

Where is the client compare to the Couchbase Server node? Is the Couchbase Server running on a local virtual machine and the client is running on the virtualization host? Is there a special network setup? Can you access the UI using 127.0.0.1:8091?

Both client and server are situated on the same machine. Admin UI is accessible by 127.0.0.1:8091.
Also

but when configuration is changed to be machine name instead of IP the call to Flush starts to work

is not true. It works only when Fiddler is enabled.