<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 09:01:59 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>[JAVA-4402] Load Zstandard library during connection creation time</title>
                <link>https://jira.mongodb.org/browse/JAVA-4402</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;Currently, the Zstandard library loading only happens when&#160;&lt;tt&gt;ZstdCompressor#compress&lt;/tt&gt;&#160;is called. This can be problematic when the caller thread cannot do a blocking call. In our case, it&apos;s Netty&apos;s event loop thread, and&#160;&lt;a href=&quot;https://github.com/reactor/BlockHound&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;BlockHound&lt;/a&gt;&#160;throws a&#160;&lt;tt&gt;BlockingOperationError&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;Instead, we can load the class when the &lt;tt&gt;ZstdCompressor&lt;/tt&gt; instance is created.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1922149">JAVA-4402</key>
            <summary>Load Zstandard library during connection creation time</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="10300" iconUrl="https://jira.mongodb.org/images/icons/priorities/medium.svg">Unknown</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="13202">Works as Designed</resolution>
                                        <assignee username="valentin.kovalenko@mongodb.com">Valentin Kavalenka</assignee>
                                    <reporter username="halil.sener@teampicnic.com">Halil &#304;brahim &#350;ener</reporter>
                        <labels>
                            <label>external-user</label>
                    </labels>
                <created>Wed, 10 Nov 2021 13:47:53 +0000</created>
                <updated>Fri, 27 Oct 2023 13:20:55 +0000</updated>
                            <resolved>Mon, 15 Nov 2021 19:57:46 +0000</resolved>
                                                                                        <votes>1</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="4207240" author="halil.sener@teampicnic.com" created="Tue, 23 Nov 2021 14:21:56 +0000"  >&lt;p&gt;Thanks for the detailed answer @Valentin Kavalenka.&lt;/p&gt;

&lt;p&gt;I don&apos;t expect a performance impact since it needs to happen only once. However, I like doing it eagerly to ensure the MongoDB driver will work with &lt;tt&gt;Zstd&lt;/tt&gt; (otherwise, fail fast). Does that make sense?&lt;/p&gt;

&lt;p&gt;As you said, the error from BlockHound can also be solved by adding a rule. OTOH, this can also be an argument to ensure the blocking call happens on a specific thread on the MongoDB driver side rather than having N MongoDB customers add the rule.&lt;/p&gt;</comment>
                            <comment id="4189982" author="JIRAUSER1258163" created="Mon, 15 Nov 2021 19:56:55 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=halil.sener%40teampicnic.com&quot; class=&quot;user-hover&quot; rel=&quot;halil.sener@teampicnic.com&quot;&gt;halil.sener@teampicnic.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;One indeed must not regularly do blocking calls in a Netty event loop thread, because doing so wastes the thread by preventing it from doing other operations that may be ready. However, doing a finite number of blocking operations in such a thread is what one may call lazy initialization, and it affects performance characteristics in the same way regardless of whether being done in an event loop thread or not. Besides lazy class/interface initialization, which the PR proposes to do eagerly for the &lt;tt&gt;Zstd&lt;/tt&gt; class because it involves a blocking operation, there is lazy resolution of symbolic references to a class/interface (see &lt;a href=&quot;https://docs.oracle.com/javase/specs/jls/se17/html/jls-12.html#jls-12.3&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;JLS 12.3&lt;/a&gt;, &lt;a href=&quot;https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-5.html#jvms-5.4.3.1&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;JVMS 5.4.3.1&lt;/a&gt;), which may result in loading a class/interface lazily, which is also usually a blocking operation. That is, there is always a possibility that a thread in a Java application may do implicit blocking operations (loading classes lazily) without an engineer being aware of it or a tool like BlockHound detecting such a possibility.&lt;/p&gt;

&lt;p&gt;We think that the proposed change should only be done based on reports that laziness negatively affects performance characteristics of an application. So far there have been no such reports. Regarding the complaint from BlockHound, it seems &lt;a href=&quot;https://github.com/reactor/BlockHound/blob/master/docs/customization.md#dis-allowing-blocking-calls-inside-methods&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;one can allow blocking calls inside a method&lt;/a&gt;. In your case, you probably can allow blocking operations inside the &lt;tt&gt;ZstdCompressor.compress&lt;/tt&gt; method, or &lt;a href=&quot;https://github.com/reactor/BlockHound/blob/master/docs/customization.md#custom-blocking-method-callback&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;customize the blocking method callback&lt;/a&gt; such that it does not report an error if the call stack contains frames for &lt;tt&gt;ZstdCompressor.compress&lt;/tt&gt; and &lt;tt&gt;Native.load&lt;/tt&gt;.&lt;/p&gt;</comment>
                            <comment id="4183945" author="esha.bhargava" created="Thu, 11 Nov 2021 19:37:59 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=halil.sener%40teampicnic.com&quot; class=&quot;user-hover&quot; rel=&quot;halil.sener@teampicnic.com&quot;&gt;halil.sener@teampicnic.com&lt;/a&gt; Thank you for reporting the issue! We&apos;ll look into it and get back to you soon.&lt;/p&gt;</comment>
                            <comment id="4182810" author="halil.sener@teampicnic.com" created="Thu, 11 Nov 2021 13:53:22 +0000"  >&lt;p&gt;I created&#160;&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/pull/821&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/pull/821&lt;/a&gt;.&lt;/p&gt;</comment>
                    </comments>
                    <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|hzsy6f:</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>