[NCBC-152] Couchbase Client hangs during instantion of the Client if the request to http://xxx.xxx.xxx.xxx:8091/pools/default/bucketsStreaming/default is blocked or never returns Created: 09/Nov/12  Updated: 30/Jan/14

Status: In Progress
Project: Couchbase .NET client library
Component/s: library
Affects Version/s: 1.2 Beta
Fix Version/s: backlog-1.0

Type: Bug Priority: Minor
Reporter: Aaron Mell Assignee: Saakshi Manocha
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment: Windows 7
Windows Server 2008 VM
AVG 2012.0.2221
Coucbase C# Client Library 1.2

Attachments: Zip Archive NCBC-152.zip     Zip Archive SimpleCouchClientTest.zip    

During instantiation of the client, a MessageStreamListener is created. Inside of the listener is a call is made to the config url

Line 376 of MessageStreamListener

this.request = this.requestFactory.GetWebRequest(configUrl, configUrl.GetHashCode().ToString());
this.response = this.request.GetResponse();

If this call never completes, for example because AVG silently blocks the request and prevents the data from being returned, then the client will wait indefinitely instead of timing out.

Comment by Aaron Mell [ 09/Nov/12 ]
Comment by Matt Ingenthron [ 17/May/13 ]
Not a priority, but let's try to come up with a way to test if this does in fact hang forever. If so, we should fix it.
Comment by Saakshi Manocha [ 24/May/13 ]
Yes it is easily reproducible. I have installed AVG on Windows7 machine and server is also installed on same machine. If AVG is enabled, client will never get instatiated, if I disable the AVG, it works perfectly.

In class Couchbase.BucketConfigListener.cs:

// subscribe to the config url
this.listener = this.GetPooledListener();

// this will be signaled by the config changed event handler

It keeps on waiting endlessly at this code statement - reset.WaitOne(). It wont even time out, the thread just keeps waiting forever.
While its waiting if we disable the AVG, then it will work absolutely fine.

The code snippet is attached herewith (i added a statement for Get() method, its not really required, but if included, code assumes we have a key '101' stored already).

another thing to notice is if in App.config, I change the server address from "http://localhost:8091/pools" to "", it would work fine. ( actually has server installed)
Comment by Saakshi Manocha [ 07/Jun/13 ]
@Matt: Please suggest how shall we proceed with this issue.
Comment by Bin Cui [ 27/Jan/14 ]
Try this command to verify if mecached runs correctly:

<installroot>/bin/cbworkloadgen -n localhost:8091 -i 1000
Comment by Vinay Pandey [ 27/Jan/14 ]
I can replicate this problem without AVG. If I keep creating the Client in the loop 10,000 times, then it gets stuck in the constructor, I am attaching my test application, here is the call-stack from WinDBG:

System.Threading.WaitHandle.InternalWaitOne(System.Runtime.InteropServices.SafeHandle, Int64, Boolean, Boolean)
Couchbase.CouchbaseClient..ctor(Couchbase.ICouchbaseServerPool, Couchbase.Configuration.ICouchbaseClientConfiguration)
SimpleCouchClientTest.Program+<>c__DisplayClass2.<Main>b__1(Int32) [\Documents\Visual Studio 2012\Projects\SimpleCouchClientTest\SimpleCouchClientTest\Program.cs @ 37]
Generated at Fri Nov 28 20:49:06 CST 2014 using JIRA 5.2.4#845-sha1:c9f4cc41abe72fb236945343a1f485c2c844dac9.