<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:55:15 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-1688] Cannot run Client on AppEngine due to thread creation constraints</title>
                <link>https://jira.mongodb.org/browse/JAVA-1688</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;TLDR?: use java.util.concurrent.Executors default thread creator instead of new Thread().&lt;/p&gt;

&lt;p&gt;See the thread here: &lt;a href=&quot;https://groups.google.com/forum/?#!msg/google-appengine/4n_YlemnINE/BG6kiRNxWdUJ&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://groups.google.com/forum/?#!msg/google-appengine/4n_YlemnINE/BG6kiRNxWdUJ&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And app engine docs here:&lt;br/&gt;
&lt;a href=&quot;https://cloud.google.com/appengine/docs/java/#Java_The_sandbox&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://cloud.google.com/appengine/docs/java/#Java_The_sandbox&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Seems like using the specific appengine api is too much, but could be plugable if needed.&lt;/p&gt;</description>
                <environment></environment>
        <key id="189629">JAVA-1688</key>
            <summary>Cannot run Client on AppEngine due to thread creation constraints</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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="scotthernandez">Scott Hernandez</reporter>
                        <labels>
                    </labels>
                <created>Sun, 15 Mar 2015 17:11:19 +0000</created>
                <updated>Mon, 5 Nov 2018 02:46:31 +0000</updated>
                            <resolved>Mon, 5 Nov 2018 02:46:31 +0000</resolved>
                                                                    <component>Cluster Management</component>
                                        <votes>1</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="1747410" author="jeff.yemin" created="Fri, 8 Dec 2017 21:31:53 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=stickfigure&quot; class=&quot;user-hover&quot; rel=&quot;stickfigure&quot;&gt;stickfigure&lt;/a&gt; is there still interest in getting the Java driver working in GAE?&lt;/p&gt;</comment>
                            <comment id="1047865" author="stickfigure" created="Wed, 30 Sep 2015 19:28:43 +0000"  >&lt;p&gt;I&apos;m happy to help figure out any way to get the driver working on App Engine. I&apos;ll reach out to you via the email in your profile. Thanks!&lt;/p&gt;</comment>
                            <comment id="1047847" author="jeff.yemin" created="Wed, 30 Sep 2015 19:16:05 +0000"  >&lt;p&gt;Hi Jeff,&lt;/p&gt;

&lt;p&gt;I&apos;d prefer finding a way where the driver can invert this so that the driver doesn&apos;t have to expose a public method that could be subject to all sorts of abuse.  I&apos;m open to having a discussion about it if you&apos;d like.&lt;/p&gt;</comment>
                            <comment id="1047734" author="stickfigure" created="Wed, 30 Sep 2015 18:04:29 +0000"  >&lt;p&gt;Nobody uses GAE backends anymore and the feature has been deprecated. You can use the Mongo driver as-is from GAE Managed VMs (which are dressed-up Compute Engine instances) but that technology has a ways to go before it&apos;s production ready, and it may never completely replace the use case of &quot;normal&quot; GAE frontends.&lt;/p&gt;

&lt;p&gt;The ideal solution, from my perspective, would be to see the monitoring logic encapsulated in a public method by itself. In normal operation, the mongo driver would start a thread which processes this method at intervals as it does now. Running in a thread-constrained environment like GAE, this method could be called within the context of an inbound request at reasonably appropriate intervals. Implemented as a servlet filter (that perhaps does the work in a parallel thread while the main request is executing), this would not require any impact on the business logic of an app.&lt;/p&gt;

&lt;p&gt;I would be happy to write and publish such a filter if I could only get access to a run() method that makes a single pass through the monitoring logic. And of course disable the thread that does the check/sleep loop.&lt;/p&gt;</comment>
                            <comment id="1047715" author="jeff.yemin" created="Wed, 30 Sep 2015 17:48:12 +0000"  >&lt;p&gt;The background tasks are required for the correctness of the driver.  See the &lt;a href=&quot;https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#multi-threaded-or-asynchronous-monitoring&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Server Discovery and Monitoring Specification&lt;/a&gt; for more information.&lt;/p&gt;

&lt;p&gt;We could make a start on this by limiting support to backends and using &lt;a href=&quot;https://cloud.google.com/appengine/docs/java/backends/#Java_Background_threads&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;background threads&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="1044497" author="stickfigure" created="Mon, 28 Sep 2015 01:25:12 +0000"  >&lt;p&gt;Just wanted to point out that it&apos;s more complicated than just using the thread creation API. In GAE frontend instances, threads can&apos;t outlive the request that started them. So there really needs to be a way of disabling whatever these threads are doing. It appears to be the DefaultServerMonitor (at least, that&apos;s the first failure):&lt;/p&gt;

&lt;p&gt;Caused by: java.security.AccessControlException: access denied (&quot;java.lang.RuntimePermission&quot; &quot;modifyThreadGroup&quot;)&lt;br/&gt;
	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372)&lt;br/&gt;
	at java.security.AccessController.checkPermission(AccessController.java:559)&lt;br/&gt;
	at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)&lt;br/&gt;
	at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:429)&lt;br/&gt;
	at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkAccess(DevAppServerFactory.java:454)&lt;br/&gt;
	at java.lang.ThreadGroup.checkAccess(ThreadGroup.java:315)&lt;br/&gt;
	at java.lang.Thread.init(Thread.java:391)&lt;br/&gt;
	at java.lang.Thread.init(Thread.java:349)&lt;br/&gt;
	at java.lang.Thread.&amp;lt;init&amp;gt;(Thread.java:548)&lt;br/&gt;
	at com.mongodb.connection.DefaultServerMonitor.createMonitorThread(DefaultServerMonitor.java:100)&lt;br/&gt;
	at com.mongodb.connection.DefaultServerMonitor.&amp;lt;init&amp;gt;(DefaultServerMonitor.java:63)&lt;br/&gt;
	at com.mongodb.connection.DefaultServerMonitorFactory.create(DefaultServerMonitorFactory.java:37)&lt;br/&gt;
	at com.mongodb.connection.DefaultServer.&amp;lt;init&amp;gt;(DefaultServer.java:61)&lt;br/&gt;
	at com.mongodb.connection.DefaultClusterableServerFactory.create(DefaultClusterableServerFactory.java:68)&lt;br/&gt;
	at com.mongodb.connection.BaseCluster.createServer(BaseCluster.java:352)&lt;br/&gt;
	at com.mongodb.connection.SingleServerCluster.&amp;lt;init&amp;gt;(SingleServerCluster.java:51)&lt;br/&gt;
	at com.mongodb.connection.DefaultClusterFactory.create(DefaultClusterFactory.java:55)&lt;br/&gt;
	at com.mongodb.Mongo.createCluster(Mongo.java:660)&lt;br/&gt;
	at com.mongodb.Mongo.createCluster(Mongo.java:646)&lt;br/&gt;
	at com.mongodb.Mongo.&amp;lt;init&amp;gt;(Mongo.java:275)&lt;br/&gt;
	at com.mongodb.MongoClient.&amp;lt;init&amp;gt;(MongoClient.java:184)&lt;br/&gt;
	at com.mongodb.MongoClient.&amp;lt;init&amp;gt;(MongoClient.java:160)&lt;/p&gt;</comment>
                            <comment id="948203" author="jeff.yemin" created="Tue, 23 Jun 2015 15:50:57 +0000"  >&lt;p&gt;You have to use &lt;a href=&quot;https://cloud.google.com/appengine/docs/java/javadoc/com/google/appengine/api/ThreadManager&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://cloud.google.com/appengine/docs/java/javadoc/com/google/appengine/api/ThreadManager&lt;/a&gt; to create threads, even when using an executor service.&lt;/p&gt;

&lt;p&gt;In order to get this to work and not add a dependency on App Engine,, we&apos;d have to allow for the injection of a thread creator deep into the driver.&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|hs74yv:</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>