<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:41:52 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>[CSHARP-2203] SynchronizationContext.Current bleed</title>
                <link>https://jira.mongodb.org/browse/CSHARP-2203</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;1. In one independent thread, context, uses a AsyncHelper.RunSync(...) wrapper invoke mongodb&apos;s UpdateOneAsync method.&lt;br/&gt;
What &quot;AsyncHelper&quot;  does is it replaces the SynchronizationContext.Current with a &quot;ExclusiveSynchronizationContext&quot;, and replace back, one finished execution.&lt;/p&gt;

&lt;p&gt;2. In another completely independent thread/context, executing following code:&lt;br/&gt;
code line 1...&lt;br/&gt;
... // SynchronizationContext.Current is null&lt;br/&gt;
await mongodb.UpdateOneAsync(); //with, or without .ConfigureAwait(false)&lt;br/&gt;
...// SynchronizationContext.Current is &quot;ExclusiveSynchronizationContext&quot;&lt;/p&gt;

&lt;p&gt;These 2 calls not related to each other. &lt;/p&gt;

&lt;p&gt;This is not 100% time happening. But when happen, it causes deadlock, or potential security issue as it leaks SynchronizationContext.&lt;/p&gt;

&lt;p&gt;The code of AsyncHelper is attached.&lt;/p&gt;</description>
                <environment>Windows server</environment>
        <key id="503259">CSHARP-2203</key>
            <summary>SynchronizationContext.Current bleed</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="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="StevenXi">Steven [X]</reporter>
                        <labels>
                            <label>deadlock</label>
                            <label>security</label>
                            <label>threading</label>
                    </labels>
                <created>Tue, 27 Feb 2018 22:47:11 +0000</created>
                <updated>Mon, 26 Nov 2018 20:51:57 +0000</updated>
                            <resolved>Mon, 26 Nov 2018 20:51:57 +0000</resolved>
                                    <version>2.5</version>
                                                    <component>Write Operations</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="2031311" author="rstam" created="Fri, 12 Oct 2018 14:46:09 +0000"  >&lt;p&gt;The C# driver does not use use SynchronizationContext and never sets it.&lt;/p&gt;

&lt;p&gt;I don&apos;t think this issue is C# driver related.&lt;/p&gt;</comment>
                            <comment id="1817856" author="stevenxi" created="Tue, 27 Feb 2018 22:48:54 +0000"  >&lt;p&gt;Currently, it only happens when we uses AsyncHelper, as we don&apos;t set SynchronizationContext elsewhere.&lt;br/&gt;
But suspect it applicable to other SynchronizationContext setting as well.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="180418" name="AsyncHelper.cs" size="4878" author="StevenXi" created="Tue, 27 Feb 2018 22:45:20 +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|hr8arz:</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>