<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:53:56 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-1164] ThreadLocal&lt;Random&gt; anonymous subclass prevents classloader from being garbage collected</title>
                <link>https://jira.mongodb.org/browse/JAVA-1164</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;Quoting from Stefan&apos;s comment:&lt;/p&gt;

&lt;p&gt;The problem is how BaseCluster.random is initialized to a ThreadLocal subclass instance. That class references the webapp&apos;s classloader. The ThreadLocal subclass in turn is referenced by each Thread instance (that&apos;s how ThreadLocals are implemented, they have a &quot;helper-Map&quot; in each Thread instance, so the leak is actually not a tiny Random instance but the whole webapp&apos;s classloader with a bunch of class definitions and statically referenced parts of the webapp&lt;/p&gt;

</description>
                <environment></environment>
        <key id="130375">JAVA-1164</key>
            <summary>ThreadLocal&lt;Random&gt; anonymous subclass prevents classloader from being garbage collected</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="jkemnade">Jochen Kemnade</reporter>
                        <labels>
                    </labels>
                <created>Thu, 10 Apr 2014 13:28:05 +0000</created>
                <updated>Fri, 1 Apr 2016 21:18:58 +0000</updated>
                            <resolved>Tue, 23 Sep 2014 15:27:13 +0000</resolved>
                                    <version>2.12.0</version>
                                    <fixVersion>2.12.4</fixVersion>
                    <fixVersion>3.0.0</fixVersion>
                                    <component>Cluster Management</component>
                                        <votes>2</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="817898" author="xgen-internal-githook" created="Fri, 30 Jan 2015 18:42:38 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;jyemin&apos;, u&apos;name&apos;: u&apos;Jeff Yemin&apos;, u&apos;email&apos;: u&apos;jeff.yemin@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-1164&quot; title=&quot;ThreadLocal&amp;lt;Random&amp;gt; anonymous subclass prevents classloader from being garbage collected&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-1164&quot;&gt;&lt;del&gt;JAVA-1164&lt;/del&gt;&lt;/a&gt;: Replaced use of ThreadLocal&amp;lt;Random&amp;gt; subclass (used to override initialValue()) with a method&lt;br/&gt;
that explicitly gets the thread local value and sets it if it&apos;s null.  This avoids some nasty classloader issues&lt;br/&gt;
that show up particularly in web applications, where this anonymous subclass is holding a reference to the&lt;br/&gt;
 entire web app classloader, which is not released until the thread exits.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/497aeabbe8038c6d72851a85dc28b08219d69672&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/497aeabbe8038c6d72851a85dc28b08219d69672&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="741632" author="jeff.yemin" created="Wed, 15 Oct 2014 13:57:33 +0000"  >&lt;p&gt;Fix released in 2.12.4&lt;/p&gt;</comment>
                            <comment id="725144" author="xgen-internal-githook" created="Tue, 23 Sep 2014 15:26:42 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;jyemin&apos;, u&apos;name&apos;: u&apos;Jeff Yemin&apos;, u&apos;email&apos;: u&apos;jeff.yemin@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-1164&quot; title=&quot;ThreadLocal&amp;lt;Random&amp;gt; anonymous subclass prevents classloader from being garbage collected&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-1164&quot;&gt;&lt;del&gt;JAVA-1164&lt;/del&gt;&lt;/a&gt;: Replaced use of ThreadLocal&amp;lt;Random&amp;gt; subclass (used to override initialValue()) with a method that explicitly gets the thread local value and sets it if it&apos;s null.&lt;br/&gt;
This avoids some nasty classloader issues that show up particularly in web applications, where this anonymous subclass is holding a reference to the entire web app classloader,&lt;br/&gt;
which is not released until the thread exits.&lt;br/&gt;
Branch: 2.12.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/e66bda8731b40122adf30ca424d9f81828cee8de&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/e66bda8731b40122adf30ca424d9f81828cee8de&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="725141" author="xgen-internal-githook" created="Tue, 23 Sep 2014 15:25:44 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;jyemin&apos;, u&apos;name&apos;: u&apos;Jeff Yemin&apos;, u&apos;email&apos;: u&apos;jeff.yemin@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-1164&quot; title=&quot;ThreadLocal&amp;lt;Random&amp;gt; anonymous subclass prevents classloader from being garbage collected&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-1164&quot;&gt;&lt;del&gt;JAVA-1164&lt;/del&gt;&lt;/a&gt;: Replaced use of ThreadLocal&amp;lt;Random&amp;gt; subclass (used to override initialValue()) with a method&lt;br/&gt;
that explicitly gets the thread local value and sets it if it&apos;s null.  This avoids some nasty classloader issues&lt;br/&gt;
that show up particularly in web applications, where this anonymous subclass is holding a reference to the&lt;br/&gt;
 entire web app classloader, which is not released until the thread exits.&lt;br/&gt;
Branch: 3.0.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/497aeabbe8038c6d72851a85dc28b08219d69672&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/497aeabbe8038c6d72851a85dc28b08219d69672&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="725125" author="jeff.yemin" created="Tue, 23 Sep 2014 15:09:30 +0000"  >&lt;p&gt;I tested the fix using Apache Tomcat 8.0.12 and a trivial servlet.  With the 2.12.3 driver I see the SEVERE log message reported in an earlier comment, and it&apos;s no longer there using 2.12.4-SNAPSHOT.&lt;/p&gt;</comment>
                            <comment id="724853" author="jeff.yemin" created="Tue, 23 Sep 2014 10:33:59 +0000"  >&lt;p&gt;The fix is also available in a 2.12.4 SNAPSHOT at: &lt;a href=&quot;https://oss.sonatype.org/content/repositories/snapshots/org/mongodb/mongo-java-driver/2.12.4-SNAPSHOT/mongo-java-driver-2.12.4-20140923.101931-15.jar&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://oss.sonatype.org/content/repositories/snapshots/org/mongodb/mongo-java-driver/2.12.4-SNAPSHOT/mongo-java-driver-2.12.4-20140923.101931-15.jar&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="724549" author="jeff.yemin" created="Mon, 22 Sep 2014 22:04:12 +0000"  >&lt;p&gt;Snapshot is available here: &lt;a href=&quot;https://oss.sonatype.org/content/repositories/snapshots/org/mongodb/mongo-java-driver/2.13.0-SNAPSHOT/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://oss.sonatype.org/content/repositories/snapshots/org/mongodb/mongo-java-driver/2.13.0-SNAPSHOT/&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="722396" author="jeff.yemin" created="Thu, 18 Sep 2014 20:18:43 +0000"  >&lt;p&gt;Thanks &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=stefanl&quot; class=&quot;user-hover&quot; rel=&quot;stefanl&quot;&gt;stefanl&lt;/a&gt; for getting to the bottom of this.  I pushed a fix to master with the suggested solution, so anyone is willing to test it, please let me know.  A 2.13.0-SHAPSHOT will be available as soon as the build passes.&lt;/p&gt;</comment>
                            <comment id="722389" author="xgen-internal-githook" created="Thu, 18 Sep 2014 20:15:40 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;jyemin&apos;, u&apos;name&apos;: u&apos;Jeff Yemin&apos;, u&apos;email&apos;: u&apos;jeff.yemin@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-1164&quot; title=&quot;ThreadLocal&amp;lt;Random&amp;gt; anonymous subclass prevents classloader from being garbage collected&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-1164&quot;&gt;&lt;del&gt;JAVA-1164&lt;/del&gt;&lt;/a&gt;: Replaced use of ThreadLocal&amp;lt;Random&amp;gt; subclass (used to override initialValue()) with a method that explicitly gets the thread local value and sets it if it&apos;s null.&lt;br/&gt;
This avoids some nasty classloader issues that show up particularly in web applications, where this anonymous subclass is holding a reference to the entire web app classloader,&lt;br/&gt;
which is not released until the thread exits.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/eb3c7a413a3b65c814dfdac9e141fad4677fba92&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/eb3c7a413a3b65c814dfdac9e141fad4677fba92&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="720986" author="gardellajuanpablo" created="Wed, 17 Sep 2014 17:49:37 +0000"  >&lt;p&gt;I&apos;ve tested Stefan Larson &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-1164?focusedCommentId=654796&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-654796&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;suggestion&lt;/a&gt; and Tomcat doesn&apos;t show the SEVERE message anymore.&lt;/p&gt;</comment>
                            <comment id="667244" author="jkemnade" created="Tue, 22 Jul 2014 07:52:12 +0000"  >&lt;p&gt;Still an issue in 2.12.3.&lt;/p&gt;</comment>
                            <comment id="661101" author="casualt" created="Wed, 16 Jul 2014 20:49:22 +0000"  >&lt;p&gt;Just thought I&apos;d report that I&apos;ve also come across this issue.&lt;/p&gt;

&lt;p&gt;We run and track several MongoClient instances at a time, and .close() them all when the web-app shutsdown/reloads (or earlier, if they aren&apos;t required any longer).&lt;/p&gt;</comment>
                            <comment id="654903" author="jkemnade" created="Thu, 10 Jul 2014 16:03:05 +0000"  >&lt;p&gt;Thanks Stefan, that&apos;s very helpful information.&lt;br/&gt;
I think that if you insist on using a ThreadLocal, there should be a &lt;tt&gt;remove()&lt;/tt&gt; method if that&apos;s the only way to prevent a memory leak. There should not be any leaks, no matter how big or small they are.&lt;br/&gt;
Also, I think that Stefan&apos;s is right, we might be overdoing it a bit with the randomness. But maybe you could do something like at the bottom of &lt;a href=&quot;http://java-performance.info/java-util-random-java-util-concurrent-threadlocalrandom-multithreaded-environments/:&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://java-performance.info/java-util-random-java-util-concurrent-threadlocalrandom-multithreaded-environments/:&lt;/a&gt;&lt;br/&gt;
Create a array of &lt;tt&gt;Random&lt;/tt&gt; instances and use them one after another. If you use a &quot;rolling&quot; &lt;tt&gt;AtomicLong&lt;/tt&gt; as the index counter and a sufficiently large array, that should do the trick. Something like&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;&amp;nbsp;&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: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;private&lt;/span&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; &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;static&lt;/span&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; &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;final&lt;/span&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; AtomicLong counter = &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;new&lt;/span&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; AtomicLong();&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: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;private&lt;/span&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; &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;static&lt;/span&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; &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;final&lt;/span&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; Random[] randomArray;&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;&amp;nbsp;&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: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;static&lt;/span&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; {&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;  randomArray = &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;new&lt;/span&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; Random[&lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;1000&lt;/span&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;];&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;  &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;for&lt;/span&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; (&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;int&lt;/span&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; i = &lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;0&lt;/span&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;; i&amp;lt;randomArray.length; i++){&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;    randomArray[i] = &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;new&lt;/span&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; Random();&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;  }&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;}&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;&amp;nbsp;&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: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;protected&lt;/span&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; Random getRandom() {&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;  &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;int&lt;/span&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; index = counter.getAndIncrement() % randomArray.length;&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;  &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;return&lt;/span&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; randomArray[index];&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;}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;I haven&apos;t tested or tried to compile the code but it should give you the general idea.&lt;/p&gt;</comment>
                            <comment id="654796" author="stefanl" created="Thu, 10 Jul 2014 14:42:05 +0000"  >&lt;p&gt;The problem is how BaseCluster.random is initialized to a ThreadLocal subclass instance. That class references the webapp&apos;s classloader. The ThreadLocal subclass in turn is referenced by each Thread instance (that&apos;s how ThreadLocals are implemented, they have a &quot;helper-Map&quot; in each Thread instance, so the leak is actually not a tiny Random instance but the whole webapp&apos;s classloader with a bunch of class definitions and statically referenced parts of the webapp&lt;/p&gt;

&lt;p&gt;Starting with Java 7 you can use java.util.concurrent.ThreadLocalRandom to sidestep the issue, but then you depend on Java 7, might be too early for that.&lt;/p&gt;

&lt;p&gt;Another option is to &lt;em&gt;not&lt;/em&gt; override ThreadLocal at all, just replace the random declaration with&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;   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;private static final ThreadLocal&amp;lt;Random&amp;gt; random = new ThreadLocal&amp;lt;Random&amp;gt;();&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;And then rewrite getRandom() to something like this:&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;protected Random getRandom() {&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;  Random result = random.get();&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;  if (result == null) {&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;    result = new Random();&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;    random.set(result);&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;  }&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;  return result;&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;}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;Yes, there&apos;s a small race condition in the code above, but it doesn&apos;t matter if an extra temporary Random instance is created and overwritten occasionally. This latter way, you just introduce a reference from a Thread instance to a JDK Random class instance (plus a ThreadLocal instance per Thread that used it), not a class from the webapp&apos;s classloader, which has way less impact.&lt;/p&gt;

&lt;p&gt;You could also add a cleanup method to BaseCluster which calls random.remove(), but if you&apos;d call that after each application request after selecting servers once or a few times there&apos;s not much advantage.&lt;/p&gt;

&lt;p&gt;By the way, is it really beneficial to pick a &lt;em&gt;random&lt;/em&gt; server? Wouldn&apos;t round-robin with a simple counter (either plain or volatile since it&apos;s not critical it always increases by one (you wanted randomness, right?) or an AtomicInteger to be sure it&apos;s incrementing by one each time) work at least as well?&lt;/p&gt;</comment>
                            <comment id="591519" author="jeff.yemin" created="Wed, 21 May 2014 12:32:27 +0000"  >&lt;p&gt;Can you provide a small sample app that reproduces the issue?  I&apos;d like to see exactly where the application creates and destroys the MongoClient, and add some instrumentation.&lt;/p&gt;
</comment>
                            <comment id="591496" author="jkemnade" created="Wed, 21 May 2014 11:56:30 +0000"  >&lt;p&gt;and 2.12.2&lt;/p&gt;</comment>
                            <comment id="570407" author="jkemnade" created="Fri, 2 May 2014 08:17:27 +0000"  >&lt;p&gt;Also affects 2.12.1&lt;/p&gt;</comment>
                            <comment id="550198" author="jkemnade" created="Tue, 15 Apr 2014 14:57:10 +0000"  >&lt;p&gt;Oh, I&apos;m sorry, I was a bit absend-minded. I do have a singleton &lt;tt&gt;MongoClient&lt;/tt&gt;. The request handler threads call &lt;tt&gt;requestStart&lt;/tt&gt; and &lt;tt&gt;requestEnsureConnection&lt;/tt&gt; when they retrieve a &lt;tt&gt;DB&lt;/tt&gt; from the &lt;tt&gt;MongoClient&lt;/tt&gt; and &lt;tt&gt;requestDone&lt;/tt&gt; when they are done.&lt;/p&gt;</comment>
                            <comment id="550173" author="jeff.yemin" created="Tue, 15 Apr 2014 14:48:18 +0000"  >&lt;p&gt;One thing I would advise you to do is avoid creating a MongoClient for each request.  There is quite a bit of overhead for a new MongoClient, and, as it&apos;s thread-safe, users generally treat a MongoClient as a singleton that is shared across all requests. If you go this route, you would open and close the MongoClient via a &lt;a href=&quot;http://docs.oracle.com/javaee/6/api/javax/servlet/ServletContextListener.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;ServletContextListener&lt;/a&gt;.&lt;/p&gt;
</comment>
                            <comment id="550143" author="jkemnade" created="Tue, 15 Apr 2014 14:36:14 +0000"  >&lt;p&gt;The main problem is that Tomcat uses a thread pool to handle incoming requests. A request creates and eventually closes the &lt;tt&gt;MongoClient&lt;/tt&gt;. Upon completion, the thread is returned to the pool but the &lt;tt&gt;ThreadLocal&lt;/tt&gt; is not removed. IMHO, closing the &lt;tt&gt;MongoClient&lt;/tt&gt; should remove the &lt;tt&gt;ThreadLocal&lt;/tt&gt;.&lt;br/&gt;
I can create a sample application but that will probably take some time.&lt;/p&gt;</comment>
                            <comment id="549996" author="jeff.yemin" created="Tue, 15 Apr 2014 13:06:58 +0000"  >&lt;p&gt;Hi Jochen,&lt;/p&gt;

&lt;p&gt;I think we need to try to reproduce this to figure out what&apos;s going on.  Can you provide a small sample web app that demonstrates the problem?  In particular, I&apos;d like to see exactly where the MongoClient instance is created and destroyed.&lt;/p&gt;


&lt;p&gt;Thanks,&lt;br/&gt;
Jeff&lt;/p&gt;</comment>
                            <comment id="549687" author="jkemnade" created="Tue, 15 Apr 2014 06:59:21 +0000"  >&lt;p&gt;Yes, all &lt;tt&gt;MongoClient&lt;/tt&gt; instances (in fact, there is only a single one) are closed when the application is shut down.&lt;/p&gt;</comment>
                            <comment id="549155" author="jeff.yemin" created="Mon, 14 Apr 2014 21:15:08 +0000"  >&lt;p&gt;OK, thanks for the new information.  Does the web application close all MongoClient instances before it&apos;s stopped?  If not, please ensure that it does and let me know if the log message is still printed.&lt;/p&gt;
</comment>
                            <comment id="548448" author="jkemnade" created="Mon, 14 Apr 2014 14:28:44 +0000"  >&lt;p&gt;I don&apos;t think that this is fixed. I use the Java driver in a web application that is deployed in a Tomcat container. The message&lt;/p&gt;

&lt;p&gt;SEVERE: The web application &lt;span class=&quot;error&quot;&gt;&amp;#91;/webapp&amp;#93;&lt;/span&gt; created a ThreadLocal with key of type &lt;span class=&quot;error&quot;&gt;&amp;#91;com.mongodb.BaseCluster$1&amp;#93;&lt;/span&gt; (value &lt;span class=&quot;error&quot;&gt;&amp;#91;com.mongodb.BaseCluster$1@106674f7&amp;#93;&lt;/span&gt;) and a value of type &lt;span class=&quot;error&quot;&gt;&amp;#91;java.util.Random&amp;#93;&lt;/span&gt; (value &lt;span class=&quot;error&quot;&gt;&amp;#91;java.util.Random@66479b9&amp;#93;&lt;/span&gt;) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.&lt;/p&gt;

&lt;p&gt;appears in the log file. I haven&apos;t yet found the time to investigate why that is the case though.&lt;/p&gt;</comment>
                            <comment id="548374" author="jeff.yemin" created="Mon, 14 Apr 2014 13:54:49 +0000"  >&lt;p&gt;As I haven&apos;t heard back from you, I&apos;m assuming that it&apos;s clear this is not a bug.  Please re-open if you disagree.&lt;/p&gt;

&lt;p&gt;Regards,&lt;br/&gt;
Jeff&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <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|hs1o8f:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>134367</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="265">Java Sprint 8</customfieldvalue>

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