<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:14:00 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-2049] Do not shutdown() sockets created by other processes</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-2049</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;In &lt;a href=&quot;https://jira.mongodb.org/browse/PHPC-912&quot; title=&quot;Child processes should not destroy clients created by parent processes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;PHPC-912&quot;&gt;&lt;del&gt;PHPC-912&lt;/del&gt;&lt;/a&gt;, a user encountered a situation where a forked child process closed a server connection that was still in use by the parent process. Since the PHP driver persists &lt;tt&gt;mongoc_client_t&lt;/tt&gt; objects in a hash table, this table was copied by the child process and then destroyed when the child process exited while the parent was still alive. Upon destruction, the PHP driver attempts to free any persisted clients with &lt;tt&gt;mongoc_client_destroy()&lt;/tt&gt;, which ultimately calls &lt;tt&gt;mongoc_socket_close()&lt;/tt&gt; for each socket. Therein, &lt;tt&gt;shutdown()&lt;/tt&gt; is called on each file descriptor. I propose that &lt;tt&gt;shutdown()&lt;/tt&gt; only be called if the socket was created by the same PID. &lt;tt&gt;close()&lt;/tt&gt; can always be called, since the operating system will handle reference counting on any shared file descriptors.&lt;/p&gt;

&lt;p&gt;We already plan to associate &lt;tt&gt;mongoc_client_t&lt;/tt&gt; objects with a file descriptor in the PHP driver, to avoid a child process utilizing an existing &lt;tt&gt;mongoc_client_t&lt;/tt&gt; created by a parent process (&lt;a href=&quot;https://jira.mongodb.org/browse/PHPC-913&quot; title=&quot;Child process should not re-use mongoc_client_t objects from parent&quot; class=&quot;issue-link&quot; data-issue-key=&quot;PHPC-913&quot;&gt;&lt;del&gt;PHPC-913&lt;/del&gt;&lt;/a&gt;); however, we have no mechanism to destroy a &lt;tt&gt;mongoc_client_t&lt;/tt&gt; and free memory without also unconditionally triggering &lt;tt&gt;shutdown()&lt;/tt&gt; for each of its sockets. AFAICT, the only alternative would be for the PHP driver to leak &lt;tt&gt;mongoc_client_t&lt;/tt&gt; objects created by other processes, which seems sloppy but may be excusable since this cleanup is happening as the PHP process terminates.&lt;/p&gt;</description>
                <environment></environment>
        <key id="353592">CDRIVER-2049</key>
            <summary>Do not shutdown() sockets created by other processes</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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="9">Done</resolution>
                                        <assignee username="jesse@mongodb.com">A. Jesse Jiryu Davis</assignee>
                                    <reporter username="jmikola@mongodb.com">Jeremy Mikola</reporter>
                        <labels>
                    </labels>
                <created>Mon, 13 Feb 2017 20:16:41 +0000</created>
                <updated>Wed, 3 May 2017 22:15:20 +0000</updated>
                            <resolved>Wed, 29 Mar 2017 20:05:46 +0000</resolved>
                                    <version>1.6.0</version>
                                    <fixVersion>1.7.0</fixVersion>
                                    <component>libmongoc</component>
                    <component>network</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1539649" author="xgen-internal-githook" created="Mon, 3 Apr 2017 18:58:22 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-2049&quot; title=&quot;Do not shutdown() sockets created by other processes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-2049&quot;&gt;&lt;del&gt;CDRIVER-2049&lt;/del&gt;&lt;/a&gt; don&apos;t shutdown sockets created by parent&lt;/p&gt;

&lt;p&gt;Store the current process id when creating a socket, and check the pid&lt;br/&gt;
in mongoc_socket_close to prevent closing a socket created by the parent&lt;br/&gt;
process. Useful for forking environments like PHP.&lt;/p&gt;

&lt;p&gt;test_mongoc_socket_check_closed proves we still shut down sockets in the&lt;br/&gt;
common case.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/13f91bcc880676a26524ab7783b4b8a8d6b8f6a1&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/13f91bcc880676a26524ab7783b4b8a8d6b8f6a1&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="353311">PHPC-912</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="353312">PHPC-913</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|hrb0lb:</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>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="1666">C Driver 2017 3 - March 8</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>