<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:17:10 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-3116] Do not disconnect sockets in mongoc_client_reset()</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-3116</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;The original summary for this issue was &quot;Calling mongoc_client_reset() in child may affect SSL sockets in parent&quot;. This issue can be addressed by removing the &lt;tt&gt;mongoc_cluster_disconnect&lt;/tt&gt; call in &lt;tt&gt;mongoc_client_reset&lt;/tt&gt;.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;While integrating &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-2857&quot; title=&quot;Provide a reset method to be called on clients after forking&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-2857&quot;&gt;&lt;del&gt;CDRIVER-2857&lt;/del&gt;&lt;/a&gt; in &lt;a href=&quot;https://jira.mongodb.org/browse/PHPC-1274&quot; title=&quot;Reset libmongoc client after forking to avoid interacting with parent resources in child processes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;PHPC-1274&quot;&gt;&lt;del&gt;PHPC-1274&lt;/del&gt;&lt;/a&gt;, I observed reproducible &lt;a href=&quot;https://travis-ci.org/mongodb/mongo-php-driver/jobs/529025685&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;test failures&lt;/a&gt; when connected to a standalone server using SSL. The tests in question do the following:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Connect to a standalone using SSL&lt;/li&gt;
	&lt;li&gt;Insert three documents into a collection&lt;/li&gt;
	&lt;li&gt;Query the collection with batchSize=2. Query execution in PHP will entail creating a cursor with the first batch of results.&lt;/li&gt;
	&lt;li&gt;Fork the process, such that the child immediately exits&lt;/li&gt;
	&lt;li&gt;The parent will wait on the child to exit, and then proceed to iterate the cursor to completion&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;This test is implemented in &lt;a href=&quot;https://github.com/mongodb/mongo-php-driver/blob/34b9d4dcaf09e6f60867b8ee9126309a5ce9bf54/tests/cursor/bug1274-001.phpt&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;bug1274-001.phpt&lt;/a&gt;. It fails due to the parent&apos;s connection being closed sometime between forking and iterating the cursor (i.e. executing a getMore).&lt;/p&gt;

&lt;p&gt;In this first log, I record the script output (above steps) and also include a relevant portion of the server log that shows the connection terminating when the child exits:&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;find command specifies batchSize: 2&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;Child exits&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;Parent waited for child to exit&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;getMore command specifies batchSize: 2&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;&amp;nbsp;&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;Fatal error: Uncaught MongoDB\Driver\Exception\ConnectionTimeoutException: Failed to send &quot;getMore&quot; command with database &quot;phongo&quot;: Failed to read 4 bytes: socket error or timeout in /home/jmikola/workspace/mongodb/phpc/tests/cursor/bug1274-001.php:59&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;&amp;nbsp;&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;2019-05-07T09:56:47.264-0400 I  NETWORK  [listener] connection accepted from 127.0.0.1:40904 #53 (1 connection now open)&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;2019-05-07T09:56:47.283-0400 I  NETWORK  [conn53] received client metadata from 127.0.0.1:40904 conn53: { driver: { name: &quot;mongoc / ext-mongodb:PHP&quot;, version: &quot;1.14.0 / 1.6.0alpha2-dev&quot; }, os: { type: &quot;Linux&quot;, name: &quot;Ubuntu&quot;, version: &quot;18.04&quot;, architecture: &quot;x86_64&quot; }, platform: &quot;cfg=0xd15ea8e9 posix=200809 stdc=201112 CC=GCC 7.4.0 CFLAGS=&quot;-g  -O0&quot; LDFLAGS=&quot;&quot; / PHP 7.2.12&quot; }&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;2019-05-07T09:56:47.284-0400 I  STORAGE  [conn53] createCollection: phongo.cursor_bug1274_001 with generated UUID: 6a9426ee-d4d3-420a-ba6d-0f1f77867eb0&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;2019-05-07T09:56:47.287-0400 I  STORAGE  [conn53] Registering catalog entry phongo.cursor_bug1274_001 with UUID 6a9426ee-d4d3-420a-ba6d-0f1f77867eb0&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;2019-05-07T09:56:47.287-0400 I  STORAGE  [conn53] Registering collection object phongo.cursor_bug1274_001 with UUID 6a9426ee-d4d3-420a-ba6d-0f1f77867eb0&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;2019-05-07T09:56:47.289-0400 I  INDEX    [conn53] index build: done building index _id_ on ns phongo.cursor_bug1274_001&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;2019-05-07T09:56:47.293-0400 I  NETWORK  [conn53] end connection 127.0.0.1:40904 (0 connections now open)&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;2019-05-07T09:56:47.784-0400 I  NETWORK  [listener] connection accepted from 127.0.0.1:40906 #54 (1 connection now open)&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;2019-05-07T09:56:47.803-0400 I  NETWORK  [conn54] end connection 127.0.0.1:40906 (0 connections now open)&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;In this second log, I have the child sleep five seconds before exiting and disabled the waitpid() in the parent so that iteration happens &lt;em&gt;before&lt;/em&gt; the child exits:&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;find command specifies batchSize: 2&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;getMore command specifies batchSize: 2&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;Parent fully iterated cursor for 3 documents&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;===DONE===&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;Child exits&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;&amp;nbsp;&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;2019-05-07T09:57:49.242-0400 I  NETWORK  [listener] connection accepted from 127.0.0.1:40910 #56 (1 connection now open)&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;2019-05-07T09:57:49.262-0400 I  NETWORK  [conn56] received client metadata from 127.0.0.1:40910 conn56: { driver: { name: &quot;mongoc / ext-mongodb:PHP&quot;, version: &quot;1.14.0 / 1.6.0alpha2-dev&quot; }, os: { type: &quot;Linux&quot;, name: &quot;Ubuntu&quot;, version: &quot;18.04&quot;, architecture: &quot;x86_64&quot; }, platform: &quot;cfg=0xd15ea8e9 posix=200809 stdc=201112 CC=GCC 7.4.0 CFLAGS=&quot;-g  -O0&quot; LDFLAGS=&quot;&quot; / PHP 7.2.12&quot; }&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;2019-05-07T09:57:49.263-0400 I  STORAGE  [conn56] createCollection: phongo.cursor_bug1274_001 with generated UUID: 055f23dc-1ac4-40e9-8242-7e23c1d400fa&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;2019-05-07T09:57:49.264-0400 I  STORAGE  [conn56] Registering catalog entry phongo.cursor_bug1274_001 with UUID 055f23dc-1ac4-40e9-8242-7e23c1d400fa&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;2019-05-07T09:57:49.264-0400 I  STORAGE  [conn56] Registering collection object phongo.cursor_bug1274_001 with UUID 055f23dc-1ac4-40e9-8242-7e23c1d400fa&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;2019-05-07T09:57:49.265-0400 I  INDEX    [conn56] index build: done building index _id_ on ns phongo.cursor_bug1274_001&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;2019-05-07T09:57:49.270-0400 I  NETWORK  [conn56] end connection 127.0.0.1:40910 (0 connections now open)&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;In both cases, it looks like resetting an SSL connection from one process affects the other. I&apos;m not sure if this is expected due to SSL interfering with being able to have two client sockets connected to the same server socket (shared file descriptor through the fork). Perhaps SSL is dropping the entire connection once it observes the child hang up?&lt;/p&gt;</description>
                <environment></environment>
        <key id="759752">CDRIVER-3116</key>
            <summary>Do not disconnect sockets in mongoc_client_reset()</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</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="13201">Fixed</resolution>
                                        <assignee username="jmikola@mongodb.com">Jeremy Mikola</assignee>
                                    <reporter username="jmikola@mongodb.com">Jeremy Mikola</reporter>
                        <labels>
                    </labels>
                <created>Tue, 7 May 2019 16:32:03 +0000</created>
                <updated>Sat, 28 Oct 2023 11:29:17 +0000</updated>
                            <resolved>Fri, 8 Nov 2019 18:55:42 +0000</resolved>
                                    <version>1.14.0</version>
                                    <fixVersion>1.16.0</fixVersion>
                                    <component>docs</component>
                    <component>libmongoc</component>
                    <component>tls</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="2526023" author="xgen-internal-githook" created="Fri, 8 Nov 2019 20:23:18 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Kevin Albertson&apos;, &apos;username&apos;: &apos;kevinAlbs&apos;, &apos;email&apos;: &apos;kevin.albertson@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-3116&quot; title=&quot;Do not disconnect sockets in mongoc_client_reset()&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-3116&quot;&gt;&lt;del&gt;CDRIVER-3116&lt;/del&gt;&lt;/a&gt; remove unused fn&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/622b3c896627fd33268bd43a08f5195e2542761b&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/622b3c896627fd33268bd43a08f5195e2542761b&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2525721" author="xgen-internal-githook" created="Fri, 8 Nov 2019 18:54:05 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Jeremy Mikola&apos;, &apos;username&apos;: &apos;jmikola&apos;, &apos;email&apos;: &apos;jmikola@gmail.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-3116&quot; title=&quot;Do not disconnect sockets in mongoc_client_reset()&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-3116&quot;&gt;&lt;del&gt;CDRIVER-3116&lt;/del&gt;&lt;/a&gt; do not disconnect in mongoc_client_reset&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/4f4268574b63677e8c5e0646c3d169769fb07a50&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/4f4268574b63677e8c5e0646c3d169769fb07a50&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2495859" author="jmikola@gmail.com" created="Tue, 22 Oct 2019 18:14:21 +0000"  >&lt;p&gt;I tested this using the &lt;a href=&quot;https://github.com/mongodb/mongo-php-driver/pull/1027/files#diff-1286347427fae0d4215f85c7ad3940c1R2&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;manager-reset-003.phpt &lt;/a&gt; test in &lt;a href=&quot;https://github.com/mongodb/mongo-php-driver/pull/1027&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;mongodb/mongo-php-driver#1027&lt;/a&gt; for &lt;a href=&quot;https://jira.mongodb.org/browse/PHPC-1274&quot; title=&quot;Reset libmongoc client after forking to avoid interacting with parent resources in child processes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;PHPC-1274&quot;&gt;&lt;del&gt;PHPC-1274&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The test connects to a server using TLS, inserts three documents, and executes a &lt;tt&gt;find&lt;/tt&gt; with &lt;tt&gt;batchSize=2&lt;/tt&gt; to obtain a cursor on the result set. It then forks and has the parent process wait on the child, which simply calls &lt;tt&gt;mongo_client_reset()&lt;/tt&gt; and terminates. The parent then continues iteration of its cursor and asserts that a socket exception occurs on the subsequent &lt;tt&gt;getMore&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;I modified &lt;tt&gt;mongoc_client_reset&lt;/tt&gt; to no longer call &lt;tt&gt;mongoc_cluster_disconnect&lt;/tt&gt; and observed that the test now fails because the parent&apos;s &lt;tt&gt;getMore&lt;/tt&gt; succeeds. This confirms our hypothesis that we can guarantee consistent behavior for TLS and non-TLS servers by simply omitting the explicit disconnect. Therefore, I propose the following:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Repurpose this ticket to modify &lt;tt&gt;mongoc_client_reset&lt;/tt&gt; to no longer call &lt;tt&gt;mongoc_cluster_disconnect&lt;/tt&gt;. It will only increment the client&apos;s generation counter and clear the session pool.&lt;/li&gt;
	&lt;li&gt;&lt;tt&gt;mongoc_cursor_destroy&lt;/tt&gt; will continue to check the client generation before killing a live cursor.&lt;/li&gt;
	&lt;li&gt;&lt;tt&gt;mongoc_client_session_destroy&lt;/tt&gt; will continue to check the client generation before returning a session to the pool.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;I&apos;ve shared additional proposals for PHP in &lt;a href=&quot;https://jira.mongodb.org/browse/PHPC-1274?focusedCommentId=2495863&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-2495863&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;this comment&lt;/a&gt; in &lt;a href=&quot;https://jira.mongodb.org/browse/PHPC-1274&quot; title=&quot;Reset libmongoc client after forking to avoid interacting with parent resources in child processes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;PHPC-1274&quot;&gt;&lt;del&gt;PHPC-1274&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="2433099" author="samantha.ritter@10gen.com" created="Wed, 25 Sep 2019 16:33:29 +0000"  >&lt;blockquote&gt;&lt;p&gt;The solution in PHP was going to add PID check logic in each driver operation to ensure we reset before our next application-invoked operation.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;That sounds terrible.&lt;/p&gt;

&lt;p&gt;Yes, unfortunately it does seem like it&apos;s out of our control.  The best we can do is probably stress in the documentation that, when using SSL, applications should close their connections before forking.&lt;/p&gt;</comment>
                            <comment id="2431926" author="jmikola@gmail.com" created="Tue, 24 Sep 2019 22:30:06 +0000"  >&lt;blockquote&gt;&lt;p&gt;Is it a reasonable workaround for you to close connections in the parent before forking?  We should at the very least update our documentation around mongoc_client_reset() to mention how it fails with SSL.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;I don&apos;t think this is possible. The entire reason we came up with the design for &lt;tt&gt;mongoc_client_reset()&lt;/tt&gt; was because our drivers don&apos;t know when the application will fork. The solution in PHP was going to add PID check logic in each driver operation to ensure we reset before our next application-invoked operation.&lt;/p&gt;

&lt;p&gt;That said, I agree that this issue would be better repurposed as a task to update the documentation for &lt;tt&gt;mongoc_client_reset()&lt;/tt&gt; since this appears to be outside of our control.&lt;/p&gt;</comment>
                            <comment id="2431703" author="samantha.ritter@10gen.com" created="Tue, 24 Sep 2019 19:54:15 +0000"  >&lt;p&gt;Right, but even though the child and parent aren&apos;t intended to both use the socket, they do still &quot;share&quot; it by virtue of the fork happening.&#160; The OpenSSL documentation around this behavior is not forthcoming.&#160; But, from what I gather from threads like&#160;&lt;a href=&quot;http://openssl.6102.n7.nabble.com/How-to-share-SSL-sessions-between-parent-and-child-process-when-doing-fork-exec-td11077.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;https://stackoverflow.com/questions/52666354/perl-forking-an-wss-connection-results-in-closure-of-the-socket-when-child-exit&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;this&lt;/a&gt;, OpenSSL caches session state with its connections, and when you fork, this information will also get duplicated to the child.&#160; So, even if the child process does not intend to use the socket, closing it messes with this shared state.&#160; Perhaps the issue comes from the state being sent to the receiving server.&#160; Without SSL, the child would close their socket and it would do nothing; maybe with SSL, the child causes the state of the shared SSL connection to change on the server, so that subsequent messages sent by the parent fail.&#160; That&apos;s my best guess at the moment.&lt;/p&gt;

&lt;p&gt;It seems like the best thing to do is to wait until after forking to do the SSL handshake, which means the parent cannot have continuous connections across forking.&#160; I don&apos;t think we could alter mongoc_client_reset() to behave correctly here, without leaving dangling sockets around.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Is it a reasonable workaround for you to close connections in the parent before forking?&#160; We should at the very least update our documentation around mongoc_client_reset() to mention how it fails with SSL.&lt;/p&gt;</comment>
                            <comment id="2429031" author="jmikola@gmail.com" created="Mon, 23 Sep 2019 20:56:17 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=samantha.ritter&quot; class=&quot;user-hover&quot; rel=&quot;samantha.ritter&quot;&gt;samantha.ritter&lt;/a&gt;: I was most certainly using OpenSSL when I reported this issue, as that&apos;s the default option for Linux (and my build script doesn&apos;t customize it). To clarify, PHP is not attempting to share connections across child and parent processes. This is related to the post-fork reset functionality, where we want child processes to abandon sockets that were opened by a parent process.&lt;/p&gt;

&lt;p&gt;I think the unexpected behavior was that when SSL is used, resetting the client affects sockets from one process affects the other. The original test presented a case where a parent loses its connection because the child reset after being forked. The intention of opening this issue was to confirm whether something about SSL means we can&apos;t rely on the reset behavior from &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-2857&quot; title=&quot;Provide a reset method to be called on clients after forking&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-2857&quot;&gt;&lt;del&gt;CDRIVER-2857&lt;/del&gt;&lt;/a&gt; as we would normally for a non-SSL connection.&lt;/p&gt;</comment>
                            <comment id="2428862" author="samantha.ritter@10gen.com" created="Mon, 23 Sep 2019 19:22:08 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=jmikola&quot; class=&quot;user-hover&quot; rel=&quot;jmikola&quot;&gt;jmikola&lt;/a&gt; why does the PHP driver needs to share SSL connections between a child and parent process?  From some research it looks like this is impossible to do with some SSL implementations, including OpenSSL.  Can you share what SSL implementation you were running with?&lt;/p&gt;</comment>
                            <comment id="2384413" author="jmikola@gmail.com" created="Fri, 23 Aug 2019 15:03:10 +0000"  >&lt;p&gt;Moving to 1.16 since we missed the boat for 1.15.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                        <issuelink>
            <issuekey id="610201">PHPC-1274</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="1026182">CDRIVER-3438</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="969214">CDRIVER-3391</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="620080">CDRIVER-2857</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </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|hv8xvz:</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>