Bug in ClusterManager class?

Hi

I’ve been experiencing some connection issues (“Unable to connecto to cluster”) while listing the couchbase buckets. After some debugging I realized that could be a race condition in the ClusterManager sendRequest method. The following are the involved lines (took it from master branch):

latch.countDown(); //line 474
success.set(true); //line 475
response.set(result); //line 476

The thing is that the mutex is decreased before setting sucess and response values, so later the code will check the success variable and could fail if success is not set before the thread starts (mutex is 0). I think the code should be:

success.set(true);
response.set(result);
latch.countDown();

Thanks!
Juanma

Hi,

Good catch! Do you mind opening a Bug on JIRA so we can check it and have it resolved as quickly as possible? I can also handle this if you like just let me know.

Thanks for the debugging work

Thanks for the quick response, I already opened a ticket in Jira let me know if you need anything else.

Thanks!
Juanma