<!-- 
RSS generated by JIRA (5.2.4#845-sha1:c9f4cc41abe72fb236945343a1f485c2c844dac9) at Fri May 24 01:46:01 CDT 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://www.couchbase.com/issues/si/jira.issueviews:issue-xml/JCBC-148/JCBC-148.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Couchbase</title>
    <link>http://www.couchbase.com/issues</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>5.2.4</version>
        <build-number>845</build-number>
        <build-date>26-12-2012</build-date>
    </build-info>

<item>
            <title>[JCBC-148] Issue with Observe API Persist.TWO and 1 dead node: Time Out when doing set operation</title>
                <link>http://www.couchbase.com/issues/browse/JCBC-148</link>
                <project id="10080" key="JCBC">Couchbase Java Client</project>
                        <description>I have a very simple Java program that connect to the 2 nodes and do a set with the following code:&lt;br/&gt;
&lt;br/&gt;
1. So I try to connect to multiple nodes&lt;br/&gt;
{code}&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;List&amp;lt;URI&amp;gt; couchbaseServerUris = new ArrayList&amp;lt;URI&amp;gt;();&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;couchbaseServerUris.add( new URI(&amp;quot;&lt;a href=&quot;http://192.168.0.108:8091/pools&quot;&gt;http://192.168.0.108:8091/pools&lt;/a&gt;&amp;quot;) );&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;couchbaseServerUris.add( new URI(&amp;quot;&lt;a href=&quot;http://192.168.0.104:8091/pools&quot;&gt;http://192.168.0.104:8091/pools&lt;/a&gt;&amp;quot;) );&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CouchbaseClient client = new CouchbaseClient( couchbaseServerUris , &amp;quot;default&amp;quot; , &amp;quot;&amp;quot; );&lt;br/&gt;
{code}&lt;br/&gt;
&lt;br/&gt;
2. Then I call the set operation&lt;br/&gt;
{code}&lt;br/&gt;
&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;OperationFuture&amp;lt;Boolean&amp;gt; stored = client.set( &amp;quot;my-dummy-key&amp;quot;,0, &amp;quot;{\&amp;quot;name\&amp;quot; : \&amp;quot;foo\&amp;quot;, \&amp;quot;title\&amp;quot; : \&amp;quot;bar-test\&amp;quot;}&amp;quot;, PersistTo.TWO);&lt;br/&gt;
{code}&lt;br/&gt;
&lt;br/&gt;
---&lt;br/&gt;
So everything is working as expected when the 2 nodes are up.&lt;br/&gt;
&lt;br/&gt;
When I kill 1 node (for example : disconnecting, or stopping, or pausing the Ubuntu VM) I have the following behavior:&lt;br/&gt;
&lt;br/&gt;
&lt;br/&gt;
When I execute this program:&lt;br/&gt;
1- I have an exception saying that 1 node is down : Expected behavior (even if we could avoid a long stack trace)&lt;br/&gt;
{code}&lt;br/&gt;
2012-11-18 08:14:55.830 WARN com.couchbase.client.vbucket.ConfigurationProviderHTTP:  Connection problems with URI &lt;a href=&quot;http://192.168.0.108:8091/pools&quot;&gt;http://192.168.0.108:8091/pools&lt;/a&gt; ...skipping&lt;br/&gt;
java.net.ConnectException: Host is down&lt;br/&gt;
{code}&lt;br/&gt;
&lt;br/&gt;
&lt;br/&gt;
2- When I do the set the program is stopped/blocked until it reaches a network timeout&lt;br/&gt;
2012-11-18 08:20:13.462 INFO com.couchbase.client.CouchbaseConnection:  Shut down Couchbase client&lt;br/&gt;
{code}&lt;br/&gt;
Error while storing : Observe Timeout - Polled Unsuccessfully for at least 40 seconds.&lt;br/&gt;
2012-11-18 08:20:13.466 INFO 		 done : true&lt;br/&gt;
		 done : {OperationStatus success=false:  Observe Timeout - Polled Unsuccessfully for at least 40 seconds.}&lt;br/&gt;
com.couchbase.client.ViewNode:  Couchbase I/O reactor terminated&lt;br/&gt;
2012-11-18 08:20:13.467 INFO com.couchbase.client.ViewNode:  Couchbase I/O reactor terminated&lt;br/&gt;
{code}&lt;br/&gt;
&lt;br/&gt;
&lt;br/&gt;
Note that it is only happening with PersistTo.TWO&lt;br/&gt;
if I use PersistTo.MASTER or PersistTo.ONE : the program is executed with no error and no stop&lt;br/&gt;
if I use PersistTo.THREE ( or more) : the program is executed, no stop with the expected observe message : ( Error while storing : Requested persistence to 3 node(s), but only 2 are available.&lt;br/&gt;
&amp;nbsp;)&lt;br/&gt;
&lt;br/&gt;
&lt;br/&gt;
</description>
                <environment>2 nodes cluster on couchbase-server-community_x86_2.0.0-1947-rel &lt;br/&gt;
&amp;nbsp;&amp;nbsp;1 node on Ubuntu (VM) &lt;br/&gt;
&amp;nbsp;&amp;nbsp;1 node on OS X&lt;br/&gt;
&lt;br/&gt;
Bucket configure with 1 replica</environment>
            <key id="20820">JCBC-148</key>
            <summary>Issue with Observe API Persist.TWO and 1 dead node: Time Out when doing set operation</summary>
                <type id="1" iconUrl="http://www.couchbase.com/issues/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="2" iconUrl="http://www.couchbase.com/issues/images/icons/priorities/critical.png">Critical</priority>
                    <status id="5" iconUrl="http://www.couchbase.com/issues/images/icons/statuses/resolved.png">Resolved</status>
                    <resolution id="1">Fixed</resolution>
                    <security id="10011">Public</security>
                        <assignee username="daschl">Michael Nitschinger</assignee>
                                <reporter username="tgrall">Tug Grall</reporter>
                        <labels>
                    </labels>
                <created>Sun, 18 Nov 2012 01:24:35 -0600</created>
                <updated>Mon, 3 Dec 2012 03:37:02 -0600</updated>
                    <resolved>Mon, 3 Dec 2012 03:37:02 -0600</resolved>
                            <version>1.1-dp4</version>
                                <fixVersion>1.1-beta</fixVersion>
                                <component>library</component>
                                <votes>0</votes>
                        <watches>0</watches>
                                                    <comments>
                    <comment id="44261" author="tgrall" created="Sun, 18 Nov 2012 01:27:25 -0600"  >Sample program</comment>
                    <comment id="44420" author="ingenthr" created="Tue, 20 Nov 2012 09:54:38 -0600"  >I do believe that&amp;#39;s actually expected behavior, but let&amp;#39;s talk through it to get your opinion.&lt;br/&gt;
&lt;br/&gt;
We have a couple of options in the state of unexpected failure.  one is we try our hardest to get the operation requested of us done and we rely on timeouts to keep from blocking forever.  The second is that we keep tabs on our connections, and if the connection is down, we fail operations immediately so as to not have the application code waiting for something that may or may not succeed.&lt;br/&gt;
&lt;br/&gt;
Had you gone in and removed the second node (click &amp;#39;remove&amp;#39; and &amp;#39;rebalance&amp;#39;), then the client should have done something similar to when you requested three nodes.  The failure you describe above is unexpected.  Further, the client library doesn&amp;#39;t really know if it&amp;#39;s temporary or permanent.&lt;br/&gt;
&lt;br/&gt;
Finally, I do want to note, and I think this is well documented, that many things with Observe protocol under them end in timeouts.  This is not the only one.  Generally speaking, application code should be ready to do *something* in the case of a timeout.</comment>
                    <comment id="44421" author="ingenthr" created="Tue, 20 Nov 2012 10:06:04 -0600"  >Tug explained this further.  The PersistTo.THREE check must be happening after doing some operations, which is a bit late considering this operation can never succeed.  The failure should be the same with a cluster that has a down node as it is with a cluster that just doesn&amp;#39;t have a primary and to replica locations.</comment>
                    <comment id="44573" author="mikew" created="Wed, 21 Nov 2012 12:52:59 -0600"  >The way Rags wrote this code originally was to do the set and then the observe. The observe part is the part that does all of the checking so the set will actually go through an then you will get the error. Similarly there is no checking for downed nodes and I don&amp;#39;t think we actually have the ability to do this at the moment, but I may be wrong.&lt;br/&gt;
&lt;br/&gt;
On another note, one other thing I thing is wrong is returning an OperationFuture from all of the observe functions, but it isn&amp;#39;t actually an asynchronous function.</comment>
                    <comment id="45065" author="daschl" created="Fri, 30 Nov 2012 03:38:41 -0600"  >&lt;a href=&quot;http://review.couchbase.org/#/c/22936/&quot;&gt;http://review.couchbase.org/#/c/22936/&lt;/a&gt;</comment>
                    <comment id="45202" author="daschl" created="Mon, 3 Dec 2012 03:37:02 -0600"  >fixed and will be available in the beta release.</comment>
                </comments>
                    <attachments>
                    <attachment id="15838" name="CouchbaseSamples.zip" size="6101" author="tgrall" created="Sun, 18 Nov 2012 01:29:14 -0600" />
                </attachments>
            <subtasks>
        </subtasks>
                <customfields>
                                                                                                                                                                                                                    <customfield id="customfield_10081" key="com.pyxis.greenhopper.jira:gh-global-rank">
                <customfieldname>Rank</customfieldname>
                <customfieldvalues>
                    <customfieldvalue>9442</customfieldvalue>
                </customfieldvalues>
            </customfield>
                                                                                    <customfield id="customfield_10181" key="com.atlassian.jira.ext.charting:timeinstatus">
                <customfieldname>Time In Status</customfieldname>
                <customfieldvalues>
                    
                </customfieldvalues>
            </customfield>
                                                </customfields>
    </item>
</channel>
</rss>