<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:11:54 UTC 2024

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 append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CDRIVER-1211] Get Segmentation fault (11) when using mongoc_bulk_operation_execute</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-1211</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;Accidently we get this stacktrace when using mongodb, and my application keeps crashing:&lt;/p&gt;

&lt;p&gt;Got signal: Segmentation fault (11), address is 0xb0 from 0x7f9ea3a010a2&lt;br/&gt;
=======Stack Trace===========&lt;br/&gt;
/opt/NetSensor/lib/libmongoc-1.0.so.0(+0x27ea1) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x7f9ea3a02ea1&amp;#93;&lt;/span&gt;&lt;br/&gt;
/opt/NetSensor/lib/libmongoc-1.0.so.0(+0x26e33) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x7f9ea3a01e33&amp;#93;&lt;/span&gt;&lt;br/&gt;
/opt/NetSensor/lib/libmongoc-1.0.so.0(+0xf735) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x7f9ea39ea735&amp;#93;&lt;/span&gt;&lt;br/&gt;
/opt/NetSensor/lib/libmongoc-1.0.so.0(+0xf98d) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x7f9ea39ea98d&amp;#93;&lt;/span&gt;&lt;br/&gt;
/opt/NetSensor/lib/libmongoc-1.0.so.0(+0x3065e) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x7f9ea3a0b65e&amp;#93;&lt;/span&gt;&lt;br/&gt;
/opt/NetSensor/lib/libmongoc-1.0.so.0(+0x30913) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x7f9ea3a0b913&amp;#93;&lt;/span&gt;&lt;br/&gt;
/opt/NetSensor/lib/libmongoc-1.0.so.0(mongoc_bulk_operation_execute+0x109) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x7f9ea39e7669&amp;#93;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;The size of each bulk is limited to 1000 in my application, and I have 4 bulks which insert into 4 different collections in the same database.&lt;br/&gt;
The execution sequence of the mongoc_bulk_operation_execute for each bulk is random in my application.&lt;/p&gt;</description>
                <environment>In CentOS7.0, RAID5, xfs filesystem, NUMA system.</environment>
        <key id="282697">CDRIVER-1211</key>
            <summary>Get Segmentation fault (11) when using mongoc_bulk_operation_execute</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="jesse@mongodb.com">A. Jesse Jiryu Davis</assignee>
                                    <reporter username="litmus">tianlei.shi</reporter>
                        <labels>
                    </labels>
                <created>Wed, 27 Apr 2016 07:57:53 +0000</created>
                <updated>Wed, 3 May 2017 22:14:08 +0000</updated>
                            <resolved>Tue, 17 May 2016 22:55:17 +0000</resolved>
                                    <version>1.3.5</version>
                                                    <component>libmongoc</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="1267093" author="jesse" created="Tue, 17 May 2016 22:55:17 +0000"  >&lt;p&gt;This code cannot compile because you have redefined &quot;collection&quot; in insert_bulk. There are too many other bugs for me to determine which is actually the cause of your crash.&lt;/p&gt;

&lt;p&gt;For example, when insert_bulk does:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;bulk = mongoc_collection_create_bulk_operation (collection, false, NULL);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;... that does &lt;b&gt;not&lt;/b&gt; affect the caller. Therefore each call to insert_bulk creates a new bulk operation, and only executes the bulk for one document out of 999.&lt;/p&gt;

&lt;p&gt;I&apos;m not able to diagnose your issue without code that I can compile and run, but I&apos;m convinced it is not a bug in the driver.&lt;/p&gt;</comment>
                            <comment id="1266212" author="litmus" created="Tue, 17 May 2016 14:25:24 +0000"  >&lt;p&gt;I think the  stream-&amp;gt;writev points to _mongoc_stream_socket_writev, an I right?&lt;/p&gt;</comment>
                            <comment id="1266189" author="litmus" created="Tue, 17 May 2016 14:15:01 +0000"  >&lt;p&gt;The attached code is more or less the same logic as the code in our software.&lt;br/&gt;
The crash happened in the function &quot;insert_bulk&quot;.&lt;br/&gt;
We insert a huge number of data in our software using the bulk operation.&lt;/p&gt;</comment>
                            <comment id="1266145" author="litmus" created="Tue, 17 May 2016 13:31:40 +0000"  >&lt;p&gt;This can only be reproduced in a special environment, and it happened randomly.&lt;br/&gt;
And our software is very huge.&lt;/p&gt;

&lt;p&gt;The bulk is created in this way:   mongoc_collection_create_bulk_operation(dbOpt-&amp;gt;collection, false, NULL);&lt;/p&gt;

&lt;p&gt;According to the backtrace, it seems the crash happened in ret = stream-&amp;gt;writev(stream, iov, iovcnt, timeout_msec);&lt;br/&gt;
Would you please tell which func stream-&amp;gt;writev points to when the bulk is created in that way.&lt;/p&gt;</comment>
                            <comment id="1266133" author="jesse" created="Tue, 17 May 2016 13:19:14 +0000"  >&lt;p&gt;Thanks for the backtrace, but I still need to see your &lt;b&gt;code&lt;/b&gt; in order to diagnose the crash. Can you please provide a Short, Self Contained, Compilable Example (&lt;a href=&quot;http://sscce.org/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://sscce.org/&lt;/a&gt;) of code that reproduces this crash? Otherwise I cannot diagnose it. Thanks!&lt;/p&gt;</comment>
                            <comment id="1266119" author="litmus" created="Tue, 17 May 2016 13:08:31 +0000"  >&lt;p&gt;Hi Davis,&lt;/p&gt;

&lt;p&gt;Having recompiled libmongoc in debug mode, I get this stacktrace by gdb. Would you please take a look?&lt;/p&gt;

&lt;p&gt;(gdb) bt&lt;br/&gt;
#0  0x00007fff2effc0b8 in ?? ()&lt;br/&gt;
#1  0x00007ffff79820e1 in mongoc_stream_writev (stream=0x7fff182cefc0, iov=0x7fff18924cc0, iovcnt=9, timeout_msec=1000)&lt;br/&gt;
    at src/mongoc/mongoc-stream.c:162&lt;br/&gt;
#2  0x00007ffff7982acf in _mongoc_stream_writev_full (stream=0x7fff182cefc0, iov=0x7fff18924cc0, iovcnt=9,&lt;br/&gt;
    timeout_msec=1000, error=0x7fff18323b38) at src/mongoc/mongoc-stream.c:486&lt;br/&gt;
#3  0x00007ffff795f686 in mongoc_cluster_run_command_rpc (cluster=0xb7d74f8, stream=0x7fff182cefc0, server_id=1,&lt;br/&gt;
    command_name=0x7fff187248a5 &quot;insert&quot;, rpc=0x7fff2effc0b0, reply_rpc=0x7fff2effc0b0, buffer=0x7fff2effbfd0,&lt;br/&gt;
    error=0x7fff18323b38) at src/mongoc/mongoc-cluster.c:162&lt;br/&gt;
#4  0x00007ffff795f977 in mongoc_cluster_run_command (cluster=0xb7d74f8, stream=0x7fff182cefc0, server_id=1,&lt;br/&gt;
    flags=MONGOC_QUERY_NONE, db_name=0x7fff18000b40 &quot;NPM&quot;, command=0x7fff2effc280, reply=0x7fff2effc200,&lt;br/&gt;
    error=0x7fff18323b38) at src/mongoc/mongoc-cluster.c:263&lt;br/&gt;
#5  0x00007ffff798ede8 in _mongoc_write_command (command=0x7fff18323e40, client=0xb7d74e0, server_stream=0x7fff18001e50,&lt;br/&gt;
    database=0x7fff18000b40 &quot;NPM&quot;, collection=0x7fff180019c0 &quot;net_meta_167885562_if2&quot;, write_concern=0x7fff18323ed0,&lt;br/&gt;
    offset=1000, result=0x7fff183238b0, error=0x7fff18323b38) at src/mongoc/mongoc-write-command.c:916&lt;br/&gt;
#6  0x00007ffff798f196 in _mongoc_write_command_execute (command=0x7fff18323e40, client=0xb7d74e0,&lt;br/&gt;
    server_stream=0x7fff18001e50, database=0x7fff18000b40 &quot;NPM&quot;, collection=0x7fff180019c0 &quot;net_meta_167885562_if2&quot;,&lt;br/&gt;
    write_concern=0x7fff18323ed0, offset=0, result=0x7fff183238b0) at src/mongoc/mongoc-write-command.c:978&lt;br/&gt;
#7  0x00007ffff795ad8a in mongoc_bulk_operation_execute (bulk=0x7fff18323830, reply=0x7fff2effc600, error=0x7fff2effc6f0)&lt;br/&gt;
    at src/mongoc/mongoc-bulk-operation.c:438&lt;br/&gt;
#8  0x000000000043b027 in databaseNoSqlBulkExecute (dbOpt=0x7fff2effc960, instId=2)&lt;br/&gt;
    at /home/release/peak2/tag/DCITS/protoAnalyzer/database/databaseLog.c:390&lt;br/&gt;
#9  0x0000000000451949 in netStatsLogFlowMetaToDatabase (instId=2, ruleId=10246, data=0x7ffd230eb7b0)&lt;br/&gt;
    at /home/release/peak2/tag/DCITS/protoAnalyzer/netStats/netStatsDatabaseLog.c:577&lt;br/&gt;
#10 0x000000000044f684 in netStatsLogFlowMetaData (instId=2, ruleId=10246, msg=0x7fff34002688)&lt;br/&gt;
    at /home/release/peak2/tag/DCITS/protoAnalyzer/netStats/netStats.c:1071&lt;br/&gt;
#11 0x000000000044fa42 in netStatsRecordCb (msg=0x7fff34002650)&lt;br/&gt;
    at /home/release/peak2/tag/DCITS/protoAnalyzer/netStats/netStats.c:1248&lt;br/&gt;
#12 0x00000000004538c4 in netStatsLogHandle (data=0x0)&lt;br/&gt;
    at /home/release/peak2/tag/DCITS/protoAnalyzer/netStats/netStatsLog.c:617&lt;br/&gt;
#13 0x000000000045d2fa in protoAnalyzerDpdkProcess (arg=0x0)&lt;br/&gt;
    at /home/release/peak2/tag/DCITS/protoAnalyzer/platform/platformLinuxDpdk.c:409&lt;br/&gt;
#14 0x00000000004d1f95 in eal_thread_loop ()&lt;br/&gt;
#15 0x00007ffff6349df5 in start_thread () from b64bpthread.so.0&lt;br/&gt;
#16 0x00007ffff60771ad in clone () from b64bc.so.6&lt;/p&gt;</comment>
                            <comment id="1249941" author="litmus" created="Fri, 29 Apr 2016 02:21:29 +0000"  >&lt;p&gt;Thanks, I&apos;ll try that when I reproduce it again.&lt;/p&gt;</comment>
                            <comment id="1249041" author="jesse" created="Thu, 28 Apr 2016 13:43:52 +0000"  >&lt;p&gt;Hi, sending me an .so file won&apos;t help, thanks. If you can send me a program that reproduces the error, which I can compile and run, then I can diagnose the error. If you&apos;re unable to do that, please at least recompile libmongoc in debug mode:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;./configure --enable-debug&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;make&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;sudo make install&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;Then the stack trace will include function names.&lt;/p&gt;</comment>
                            <comment id="1248649" author="litmus" created="Thu, 28 Apr 2016 03:11:17 +0000"  >&lt;p&gt;I was using mongoc_bulk_operation_execute in a large system. And this issue isn&apos;t 100% reproducable. Sometimes it happens and after rebooting the OS it works fine again.&lt;/p&gt;

&lt;p&gt;Could you find which line of code is for /opt/NetSensor/lib/libmongoc-1.0.so.0(+0x27ea1) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x7f9ea3a02ea1&amp;#93;&lt;/span&gt;?&lt;br/&gt;
Do you need me to provide the .so file?&lt;/p&gt;</comment>
                            <comment id="1247704" author="jesse" created="Wed, 27 Apr 2016 12:35:26 +0000"  >&lt;p&gt;Can you please provide a Short, Self Contained, Compilable Example (&lt;a href=&quot;http://sscce.org/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://sscce.org/&lt;/a&gt;) of code that reproduces this crash? Otherwise I cannot diagnose it. Thanks!&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="122107" name="bulk_crash.c" size="1890" author="litmus" created="Tue, 17 May 2016 14:15:01 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hskudz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>