<!-- 
RSS generated by JIRA (5.2.4#845-sha1:c9f4cc41abe72fb236945343a1f485c2c844dac9) at Sat May 18 09:34:03 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/PCBC-147/PCBC-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>[PCBC-147] Segmentation Fault (segfault) when querying view</title>
                <link>http://www.couchbase.com/issues/browse/PCBC-147</link>
                <project id="10049" key="PCBC">Couchbase PHP client library</project>
                        <description>When doing a query against a view, the php application segfaults. Set/get/delete commands all work fine.&lt;br/&gt;
&lt;br/&gt;
Attached is an strace, a stack trace from gdb, and various other support files, including the repro script.</description>
                <environment>PHP 5.3.13 / 5.3.15, Redhat 5.6</environment>
            <key id="20794">PCBC-147</key>
            <summary>Segmentation Fault (segfault) when querying view</summary>
                <type id="1" iconUrl="http://www.couchbase.com/issues/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="1" iconUrl="http://www.couchbase.com/issues/images/icons/priorities/blocker.png">Blocker</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="mnunberg">Mark Nunberg</assignee>
                                <reporter username="chuyskywalker">Jeff Minard</reporter>
                        <labels>
                    </labels>
                <created>Thu, 15 Nov 2012 15:58:59 -0600</created>
                <updated>Mon, 19 Nov 2012 01:51:53 -0600</updated>
                    <resolved>Mon, 19 Nov 2012 01:51:53 -0600</resolved>
                            <version>1.1.0-dp5</version>
                                <fixVersion>1.1.0</fixVersion>
                                <component>library</component>
                                <votes>0</votes>
                        <watches>1</watches>
                                                    <comments>
                    <comment id="44149" author="chuyskywalker" created="Thu, 15 Nov 2012 15:59:19 -0600"  >I was asked to run a gdb, but I don&amp;#39;t really think it looks that helpful. I&amp;#39;ve attached it.</comment>
                    <comment id="44150" author="chuyskywalker" created="Thu, 15 Nov 2012 16:03:24 -0600"  >gdb file, looks pretty useless without a php debug symbols version</comment>
                    <comment id="44151" author="mnunberg" created="Thu, 15 Nov 2012 16:04:06 -0600"  >My bad. Type &amp;#39;bt&amp;#39; when you get the segfault :)&lt;br/&gt;
&lt;br/&gt;
That&amp;#39;ll show you the stack trace</comment>
                    <comment id="44152" author="chuyskywalker" created="Thu, 15 Nov 2012 16:12:57 -0600"  >Yes, this looks much more helpful :)</comment>
                    <comment id="44153" author="chuyskywalker" created="Thu, 15 Nov 2012 16:15:14 -0600"  >Here is the same segfault when using the latest couchbase.so compiled from the github master branch (so, cutting edge, I&amp;#39;d seen some lcb changes, so I figured I&amp;#39;d give ya both).</comment>
                    <comment id="44154" author="mnunberg" created="Thu, 15 Nov 2012 16:28:21 -0600"  >Can you try this patch?&lt;br/&gt;
&lt;br/&gt;
diff --git a/views.c b/views.c&lt;br/&gt;
index 6c7bc30..7d03c5a 100644&lt;br/&gt;
--- a/views.c&lt;br/&gt;
+++ b/views.c&lt;br/&gt;
@@ -52,12 +52,13 @@ void php_couchbase_complete_callback(lcb_http_request_t request,&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;return;&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br/&gt;
&amp;nbsp;&lt;br/&gt;
+       /** We have one extra byte in &amp;#39;data&amp;#39; */&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;hti = emalloc(sizeof(*hti) + resp-&amp;gt;v.v0.nbytes);&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;hti-&amp;gt;ndata = resp-&amp;gt;v.v0.nbytes;&lt;br/&gt;
-       memcpy(hti-&amp;gt;data, resp-&amp;gt;v.v0.bytes, hti-&amp;gt;ndata + 1);&lt;br/&gt;
+&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (hti-&amp;gt;ndata) {&lt;br/&gt;
-               hti-&amp;gt;data[hti-&amp;gt;ndata - 1] = &amp;#39;\0&amp;#39;;&lt;br/&gt;
-               hti-&amp;gt;ndata--;&lt;br/&gt;
+               memcpy(hti-&amp;gt;data, resp-&amp;gt;v.v0.bytes, hti-&amp;gt;ndata);&lt;br/&gt;
+               hti-&amp;gt;data[hti-&amp;gt;ndata] = &amp;#39;\0&amp;#39;;&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br/&gt;
&amp;nbsp;&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ctx-&amp;gt;res-&amp;gt;rc = error;&lt;br/&gt;
&lt;br/&gt;
I&amp;#39;ll make it as a gerrit changeset as well..&lt;br/&gt;
</comment>
                    <comment id="44155" author="mnunberg" created="Thu, 15 Nov 2012 16:32:25 -0600"  >&lt;a href=&quot;http://review.couchbase.org/22573&quot;&gt;http://review.couchbase.org/22573&lt;/a&gt;</comment>
                    <comment id="44157" author="chuyskywalker" created="Thu, 15 Nov 2012 16:37:59 -0600"  >That changed fixed the segfault, yes. The value assigned to the variable from the $cb-&amp;gt;view() call is bool(false)</comment>
                    <comment id="44158" author="ingenthr" created="Thu, 15 Nov 2012 16:43:36 -0600"  >Thanks for the quick work Mark!  Looks like it&amp;#39;ll be closeable after it&amp;#39;s reviewed and in.</comment>
                </comments>
                    <attachments>
                    <attachment id="15822" name="cbt.php" size="220" author="chuyskywalker" created="Thu, 15 Nov 2012 15:58:59 -0600" />
                    <attachment id="15827" name="gdb-bt-git.txt" size="1410" author="chuyskywalker" created="Thu, 15 Nov 2012 16:15:14 -0600" />
                    <attachment id="15826" name="gdb-bt.txt" size="1389" author="chuyskywalker" created="Thu, 15 Nov 2012 16:12:57 -0600" />
                    <attachment id="15825" name="gdb.txt" size="926" author="chuyskywalker" created="Thu, 15 Nov 2012 16:03:24 -0600" />
                    <attachment id="15823" name="php-m-i.txt" size="811" author="chuyskywalker" created="Thu, 15 Nov 2012 15:58:59 -0600" />
                    <attachment id="15824" name="strace.txt" size="90002" author="chuyskywalker" created="Thu, 15 Nov 2012 15:58:59 -0600" />
                </attachments>
            <subtasks>
        </subtasks>
                <customfields>
                                                                                                                                                                                                                    <customfield id="customfield_10081" key="com.pyxis.greenhopper.jira:gh-global-rank">
                <customfieldname>Rank</customfieldname>
                <customfieldvalues>
                    <customfieldvalue>9760</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>