<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:16:53 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-2996] AIX failed unit tests</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-2996</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;Failed unit tests on AIX for 1.14.0 (these failures are consistent since at least 1.12.0 - some of the socket ones since 1.7ish)&lt;/p&gt;

&lt;p&gt;cmake -DENABLE_SRV=OFF -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..&lt;/p&gt;

&lt;p&gt;Output from failed unit tests is attached.&#160; Tests are failing for 2 reasons:&lt;/p&gt;

&lt;p&gt;#1 AIX poll function does not set POLLHUP in revents&lt;br/&gt;
/Socket/connect_refusal&lt;br/&gt;
/TOPOLOGY/scanner_connection_error&lt;br/&gt;
/TOPOLOGY/dns&lt;br/&gt;
/TOPOLOGY/happy_eyeballs/1 &lt;br/&gt;
/TOPOLOGY/happy_eyeballs/4&lt;br/&gt;
/TOPOLOGY/happy_eyeballs/9&lt;/p&gt;

&lt;p&gt;For reference, AIX poll function.&lt;br/&gt;
&lt;a href=&quot;https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/com.ibm.aix.basetrf1/poll.htm&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/com.ibm.aix.basetrf1/poll.htm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Taking the first test as an example, the sequence:&lt;br/&gt;
Create a socket and connect to local host on a port with nothing there (localhost:12345)&lt;br/&gt;
Test ignores the failure on connect&lt;br/&gt;
Use poll() on the socket&lt;br/&gt;
The test is expecting to get POLLHUP back in the revents field from the poll request. However, AIX does not return POLLHUP, it returns POLLOUT so it keeps trying until it exceeds the time limit set by the test.&lt;/p&gt;

&lt;p&gt;Created quick reference code (attached) to connect to localhost on a port with nothing there followed by a poll request to see the difference between AIX and Redhat:&lt;/p&gt;

&lt;p&gt;ON AIX &#8211; 79 is ECONNREFUSED&lt;br/&gt;
test &amp;gt; ./a.out&lt;br/&gt;
connect failed. 79&lt;br/&gt;
poll_ret: 1&lt;br/&gt;
revents: 2&lt;br/&gt;
POLLHUP: 8192&lt;br/&gt;
poll success!&lt;/p&gt;

&lt;p&gt;ON REDHAT &#8211; 115 is EINPROGRESS&lt;br/&gt;
$ ./a.out&lt;br/&gt;
connect failed. 115&lt;br/&gt;
poll_ret: 1&lt;br/&gt;
revents: 28&lt;br/&gt;
POLLHUP: 16&lt;br/&gt;
getsockopt optval: 111&lt;br/&gt;
(111 is connection refused)&lt;/p&gt;

&lt;p&gt;Changing localhost to somewhere else, it returns EINPROGRESS on connect, but does not set POLLHUP, however the socket error is set to ECONNREFUSED.&lt;br/&gt;
test &amp;gt; ./a.out&lt;br/&gt;
connect failed. 55&lt;br/&gt;
poll_ret: 1&lt;br/&gt;
revents: 2&lt;br/&gt;
POLLHUP: 8192&lt;br/&gt;
getsockopt optval: 79&lt;/p&gt;

&lt;p&gt;As a workaround, I patched mongoc-socket.c to check the last socket error after calling poll and if it is ECONNREFUSED to set POLLHUP in the revents returned for the stream so that it will follow the expected path when the connection is refused on the initial connection. The diff is attached.&lt;/p&gt;

&lt;p&gt;This fixed all of the test cases listed above.&lt;/p&gt;

&lt;p&gt;Any feedback on this workaround or alternative suggestions?&lt;/p&gt;

&lt;p&gt;#2 getaddrinfo() not returning ipv6 sorted before ipv4&lt;br/&gt;
/TOPOLOGY/happy_eyeballs/10&lt;br/&gt;
/TOPOLOGY/happy_eyeballs/16&lt;br/&gt;
/TOPOLOGY/happy_eyeballs/dns_cache/&lt;/p&gt;

&lt;p&gt;The unit tests assume getaddrinfo() will return the results sorted with ipv6 before ipv4 as the connections are attempted in that order. The ordering though is configurable (gai.conf for example). For some (undetermined) reason, results for localhost are coming back ipv4 before ipv6 when call getaddrinfo().&lt;/p&gt;

&lt;p&gt;To confirm that the ordering from getaddrinfo() is causing these unit tests to fail I (temporarily) modified mongoc-topology-scanner.c to try ipv6 before ipv4 and the tests passed.&#160; These failures look to be due to configuration in our environment.&#160; No real question here other than maybe the unit tests should check the assumption about the ordering of results from getaddrinfo()?&lt;/p&gt;</description>
                <environment>AIX 7.1&lt;br/&gt;
gcc (GCC) 7.2.0</environment>
        <key id="710877">CDRIVER-2996</key>
            <summary>AIX failed unit tests</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="2">Won&apos;t Fix</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="amygiersch">Amy Giersch</reporter>
                        <labels>
                            <label>bg-rf</label>
                    </labels>
                <created>Wed, 6 Mar 2019 18:27:58 +0000</created>
                <updated>Mon, 5 Feb 2024 19:39:18 +0000</updated>
                            <resolved>Mon, 5 Feb 2024 19:39:18 +0000</resolved>
                                    <version>1.14.0</version>
                                                    <component>libmongoc</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="6068408" author="JIRAUSER1269924" created="Mon, 5 Feb 2024 19:39:18 +0000"  >&lt;p&gt;Closing as won&apos;t do as we can&apos;t test AIX. If this is still an issue for you, please feel free to submit a pull request. Thanks.&#160;&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="210662" name="mongoc 1.14 failed unit tests.txt" size="3281" author="amygiersch" created="Wed, 6 Mar 2019 18:13:22 +0000"/>
                            <attachment id="210663" name="mongoc-socket diff.txt" size="856" author="amygiersch" created="Wed, 6 Mar 2019 18:13:22 +0000"/>
                            <attachment id="210664" name="socket_test.c" size="1479" author="amygiersch" created="Wed, 6 Mar 2019 18:13:22 +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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>CDRIVER-2733</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr6jfr:</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>