<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:52:41 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-616] Semaphore released more times than acquired (java.lang.Error thrown on java 7)</title>
                <link>https://jira.mongodb.org/browse/JAVA-616</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;It seems like &lt;tt&gt;_waiting&lt;/tt&gt; semaphore release more times than acquired. &lt;/p&gt;

&lt;p&gt;Java 6 was tolerant to releasing a lot of permits (so it just overflows without any significant promblems). It may hold some threads in temporal starvation (because semapthore will have negative number of permits). But with such error after some time it will return to normal state.&lt;/p&gt;

&lt;p&gt;But Java 7 will throw &lt;tt&gt;java.lang.Error&lt;/tt&gt; in such case. &lt;/p&gt;

&lt;p&gt;There&apos;s stack trace:&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;java.lang.Error: Maximum permit count exceeded&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;  at java.util.concurrent.Semaphore$Sync.tryReleaseShared(Semaphore.java:197) [rt.jar:1.7.0_04]&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;  at java.util.concurrent.locks.AbstractQueuedSynchronizer.releaseShared(AbstractQueuedSynchronizer.java:1340) [rt.jar:1.7.0_04]&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;  at java.util.concurrent.Semaphore.release(Semaphore.java:431) [rt.jar:1.7.0_04]&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;  at com.mongodb.util.SimplePool.done(SimplePool.java:129) [mongo-java-driver-2.7.3.jar:]&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;  at com.mongodb.util.SimplePool.done(SimplePool.java:103) [mongo-java-driver-2.7.3.jar:]&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;</description>
                <environment>linux 2.6, 3.4&lt;br/&gt;
openjdk7, oracle jdk7 (u2, u4, u5)</environment>
        <key id="46124">JAVA-616</key>
            <summary>Semaphore released more times than acquired (java.lang.Error thrown on java 7)</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="9">Done</resolution>
                                        <assignee username="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="grossws">gross</reporter>
                        <labels>
                            <label>crash</label>
                            <label>driver</label>
                    </labels>
                <created>Thu, 2 Aug 2012 21:21:49 +0000</created>
                <updated>Wed, 29 Aug 2012 20:08:04 +0000</updated>
                            <resolved>Tue, 7 Aug 2012 17:27:24 +0000</resolved>
                                    <version>2.7.3</version>
                                    <fixVersion>2.9.0</fixVersion>
                                    <component>Connection Management</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="158209" author="jeff.yemin" created="Wed, 29 Aug 2012 20:08:04 +0000"  >&lt;p&gt;Closing as part of 2.9.0 release process.&lt;/p&gt;</comment>
                            <comment id="151184" author="auto" created="Tue, 7 Aug 2012 17:25:40 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;date&apos;: u&apos;2012-08-07T09:36:06-07:00&apos;, u&apos;email&apos;: u&apos;jeff.yemin@10gen.com&apos;, u&apos;name&apos;: u&apos;Jeff Yemin&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-616&quot; title=&quot;Semaphore released more times than acquired (java.lang.Error thrown on java 7)&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-616&quot;&gt;&lt;del&gt;JAVA-616&lt;/del&gt;&lt;/a&gt;: To fix issue with the Semaphore overflowing, made SimplePool class a lot... simpler.&lt;br/&gt;
  1. Removed support for unlimited pool size.  Now there is a single maximum size of the pool, representing the total number of potentially available and in-use members&lt;br/&gt;
  2. Semaphore now has one permit for each pool member that are potentially available (either in available list or could be created).&lt;br/&gt;
  3. Synchronized on this.  Only enter synchronization block in get method if a permit has been acquired&lt;br/&gt;
  4. Keeping track of list of available members (_avail) and set of checked out members (_out).&lt;br/&gt;
    Get method removes from _avail or creates new member, and adds to _out.  Done method removes from _out and adds to _avail.&lt;br/&gt;
  5. Removed debug and track leaks support&lt;br/&gt;
  6. Updated JMX monitoring interface to reflect the new structure.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/ade11ca176b1bb729f5f65a673e507f2217bbbf4&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/ade11ca176b1bb729f5f65a673e507f2217bbbf4&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="150395" author="jeff.yemin" created="Fri, 3 Aug 2012 17:57:04 +0000"  >&lt;p&gt;Thanks for reporting this.  Can you work around this for now by restarting your application more often than that?&lt;/p&gt;</comment>
                            <comment id="150167" author="grossws" created="Fri, 3 Aug 2012 06:31:29 +0000"  >&lt;p&gt;Yes, about 2 months.&lt;/p&gt;</comment>
                            <comment id="150148" author="jeff.yemin" created="Fri, 3 Aug 2012 02:45:17 +0000"  >&lt;p&gt;Yeah, I see the difference in the code for Java 6 and Java 7.  This will happen after Integer.MAX_VALUE uncontended releases to the connection pool.  I assume this happened after running your application for quite a while?&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|hrghlb:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9788</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>