<!-- 
RSS generated by JIRA (5.2.4#845-sha1:c9f4cc41abe72fb236945343a1f485c2c844dac9) at Sat May 25 13:14:56 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/CCBC-147/CCBC-147.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>[CCBC-147] function lcb_wait works infinitly after trying to connect (by calling lcb_connect) to Couchbase server that is on Pending state </title>
                <link>http://www.couchbase.com/issues/browse/CCBC-147</link>
                <project id="10070" key="CCBC">Couchbase C client library libcouchbase</project>
                        <description>Start server with one node.&lt;br/&gt;
Create many buckets, that uses all allowed memory -&amp;gt; Server have to chnage status on Pending (In my situation server stay in Pending for all time and can&amp;#39;t change it to Up)&lt;br/&gt;
&lt;br/&gt;
After that try to connect to one of the bucket by calling lcb_connect.&lt;br/&gt;
Call lcb_wait to wait for connection is done.&lt;br/&gt;
As a result lcb_wait work infinitly and timeout doesn&amp;#39;t happen&lt;br/&gt;
&lt;br/&gt;
Below I share call stack in Red Hat Linux:&lt;br/&gt;
#0  0x00000034350d4473 in __epoll_wait_nocancel () from /lib64/libc.so.6&lt;br/&gt;
#1  0x00002ad81b1dccc9 in ?? () from ./lib/libevent-2.0.so.5&lt;br/&gt;
#2  0x00002ad81b1c9cdc in event_base_loop () from ./lib/libevent-2.0.so.5&lt;br/&gt;
#3  0x00002ad8174c1dc6 in lcb_wait () from ./lib/libcouchbase.so.2&lt;br/&gt;
#4  0x000000000043c0e1 in Couchbase::connect (this=0x60df508) at couchbase_loader_source/couchbase.cpp:152&lt;br/&gt;
#5  0x000000000043c8b7 in connect_to_bucket (cbase=..., config=..., bucket_name=...) at couchbase_loader_source/couchbase.cpp:478&lt;br/&gt;
#6  0x0000000000440924 in couchbase_loader::writer_thread::writer_thread (this=0x60df480, config=..., bucket_name=..., dbh=...) at couchbase_loader_source/writer_thread.cpp:25&lt;br/&gt;
#7  0x000000000042168c in main (argc=1, argv=0x7fff22162028) at couchbase_loader_source/couchbase_loader.cpp:175&lt;br/&gt;
</description>
                <environment>I reproduced a bug on Linux Rad Hat 5.0 x64 and on Windows XP x32&lt;br/&gt;
Couchbase server version 1.8.1 &lt;br/&gt;
libcouchbase version 2.0.1</environment>
            <key id="21423">CCBC-147</key>
            <summary>function lcb_wait works infinitly after trying to connect (by calling lcb_connect) to Couchbase server that is on Pending state </summary>
                <type id="1" iconUrl="http://www.couchbase.com/issues/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.couchbase.com/issues/images/icons/priorities/major.png">Major</priority>
                    <status id="6" iconUrl="http://www.couchbase.com/issues/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                    <security id="10011">Public</security>
                        <assignee username="avsej">Sergey Avseyev</assignee>
                                <reporter username="Haster">Haster</reporter>
                        <labels>
                    </labels>
                <created>Wed, 19 Dec 2012 06:25:30 -0600</created>
                <updated>Tue, 5 Mar 2013 16:07:54 -0600</updated>
                    <resolved>Tue, 5 Mar 2013 15:47:44 -0600</resolved>
                            <version>2.0.1</version>
                                <fixVersion>2.0.4</fixVersion>
                                <component>library</component>
                                <votes>0</votes>
                        <watches>1</watches>
                                                    <comments>
                    <comment id="46570" author="Haster" created="Wed, 26 Dec 2012 02:12:36 -0600"  >I&#8217;ve investigated a little this problem and I have additional info.&lt;br/&gt;
&lt;br/&gt;
My error happened scenario:&lt;br/&gt;
&lt;br/&gt;
First of all I try to connect to some bucket (Primary for example) which is absent&lt;br/&gt;
&lt;br/&gt;
lcb_connect&lt;br/&gt;
lcb_wait&lt;br/&gt;
&lt;br/&gt;
here I get error. Then I create bucket, destroy instance by calling lcb_destroy and try connect to bucket again:&lt;br/&gt;
&lt;br/&gt;
func_create_bucket()&lt;br/&gt;
sleep(some_time)&lt;br/&gt;
lcb_destroy()&lt;br/&gt;
lcb_create()&lt;br/&gt;
lcb_connect()&lt;br/&gt;
lcb_wait()&lt;br/&gt;
&lt;br/&gt;
After that I receive 3 messages from my error_callback function, where errinfo is &#8220;Number of vBuckets must be a power of two &amp;gt; 0 and &amp;lt;= 65536&#8221;&lt;br/&gt;
And deadlock happened in lcb_wait.&lt;br/&gt;
</comment>
                    <comment id="46601" author="Haster" created="Thu, 27 Dec 2012 07:24:14 -0600"  >I&amp;#39;ve investigated this issue more deeply.&lt;br/&gt;
The problem take place then connection timeout happend.&lt;br/&gt;
&lt;br/&gt;
connect&lt;br/&gt;
lcb_wait&lt;br/&gt;
&amp;nbsp;&amp;nbsp;lcb_io_run_event_loop (for Windows Platform)&lt;br/&gt;
&amp;nbsp;&amp;nbsp;...&lt;br/&gt;
&amp;nbsp;&amp;nbsp;select&lt;br/&gt;
&lt;br/&gt;
&amp;nbsp;&amp;nbsp;if (ret == 0)    &amp;lt;-- 0 then timeout happend&lt;br/&gt;
&amp;nbsp;&amp;nbsp;{&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;-- Here our problems begin&lt;br/&gt;
&amp;nbsp;&amp;nbsp;}&lt;br/&gt;
&lt;br/&gt;
After select returns zero code tries to reconnect in callback function(is it good idea? Maybe it is better to exit from loop and return error?), but some structures (as I think) are corrupted after that.&lt;br/&gt;
After that event_loop calls select function, but timeout variable contain zero value (infinitly execution)...&lt;br/&gt;
&lt;br/&gt;
As I think, problem is near here</comment>
                    <comment id="47540" author="avsej" created="Thu, 10 Jan 2013 14:54:55 -0600"  >could you post a piece of source code, demonstrating the issue?</comment>
                    <comment id="47545" author="avsej" created="Thu, 10 Jan 2013 15:05:07 -0600"  >Possibly this patch has been fixed the issue &lt;a href=&quot;https://github.com/couchbase/libcouchbase/commit/d4948192439e61a8cc23d5e8572e81db1aebef7f&quot;&gt;https://github.com/couchbase/libcouchbase/commit/d4948192439e61a8cc23d5e8572e81db1aebef7f&lt;/a&gt;&lt;br/&gt;
&lt;br/&gt;
Could you verify with libcouchbase from master?&lt;br/&gt;
&lt;br/&gt;
To do so either pull and build the sources:&lt;br/&gt;
&lt;br/&gt;
git clone &lt;a href=&quot;git://github.com/couchbase/libcouchbase.git&quot;&gt;git://github.com/couchbase/libcouchbase.git&lt;/a&gt;&lt;br/&gt;
cd libcouchbase&lt;br/&gt;
./config/autorun.sh &amp;amp;&amp;amp; ./configure &amp;amp;&amp;amp; make &amp;amp;&amp;amp; sudo make install&lt;br/&gt;
&lt;br/&gt;
or install from snapsot deb/rpm repositories, like for example for recent ubuntus&lt;br/&gt;
&lt;br/&gt;
sudo wget -O/etc/apt/sources.list.d/couchbase-snapshot.list &lt;a href=&quot;http://packages.couchbase.com/snapshot/ubuntu/couchbase-ubuntu1110.list&quot;&gt;http://packages.couchbase.com/snapshot/ubuntu/couchbase-ubuntu1110.list&lt;/a&gt;&lt;br/&gt;
sudo aptitude update&lt;br/&gt;
sudo aptitude install libcouchbase-dev libcouchbase2-bin</comment>
                    <comment id="47551" author="Haster" created="Thu, 10 Jan 2013 15:40:50 -0600"  >My code is very big :one application server creates many processes (couchbase_loader)(one process for each cache) and whose processes operate with couchbase.&lt;br/&gt;
But also they cooperate with oracle database...&lt;br/&gt;
If you want I can share all code, but you need Oracle to run it. Or I can try to write more simple testcase...&lt;br/&gt;
&lt;br/&gt;
Also I will check patch tomorrow and share results </comment>
                    <comment id="47576" author="Haster" created="Fri, 11 Jan 2013 02:30:51 -0600"  >It looks good now. Thanks a lot</comment>
                    <comment id="47591" author="Haster" created="Fri, 11 Jan 2013 06:49:31 -0600"  >Sergey, I reproduced this issue on Windows platform.&lt;br/&gt;
Now it works more stable, but than I&amp;#39;ve tried to create 9 buckets in same time by executing 9 copies of my program 4 of them deadlocked in lcb_wait function.</comment>
                    <comment id="47660" author="Haster" created="Sun, 13 Jan 2013 10:21:47 -0600"  >&#1044;&#1086;&#1073;&#1072;&#1074;&#1083;&#1077;&#1085;&#1072; &#1090;&#1077;&#1089;&#1090;&#1086;&#1074;&#1072;&#1103; &#1087;&#1088;&#1086;&#1075;&#1088;&#1072;&#1084;&#1084;&#1072; &#1076;&#1083;&#1103; &#1074;&#1086;&#1089;&#1087;&#1088;&#1086;&#1080;&#1079;&#1074;&#1077;&#1076;&#1077;&#1085;&#1080;&#1103; &#1087;&#1088;&#1086;&#1073;&#1083;&#1077;&#1084;&#1099;</comment>
                    <comment id="49888" author="avsej" created="Wed, 6 Feb 2013 14:04:01 -0600"  >Fixed invalid memory access in win32 plugin &lt;a href=&quot;http://review.couchbase.org/24451&quot;&gt;http://review.couchbase.org/24451&lt;/a&gt;</comment>
                </comments>
                <issuelinks>
                        <issuelinktype id="10001">
                <name>Duplicate</name>
                                                <inwardlinks description="is duplicated by">
                            <issuelink>
            <issuekey id="21721">CCBC-167</issuekey>
        </issuelink>
                    </inwardlinks>
                            </issuelinktype>
                    </issuelinks>
                <attachments>
                    <attachment id="16180" name="cloader.rar" size="2070177" author="Haster" created="Sun, 13 Jan 2013 10:21:47 -0600" />
                    <attachment id="16181" name="NMakefile_new" size="5449" author="Haster" created="Sun, 13 Jan 2013 10:21:47 -0600" />
                </attachments>
            <subtasks>
        </subtasks>
                <customfields>
                                                                                                                                                                                                                    <customfield id="customfield_10081" key="com.pyxis.greenhopper.jira:gh-global-rank">
                <customfieldname>Rank</customfieldname>
                <customfieldvalues>
                    <customfieldvalue>8609</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>