You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2023/04/06 13:14:06 UTC
[tomcat] branch main updated: Initialize Random during server initialization
This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 973ef49b4f Initialize Random during server initialization
973ef49b4f is described below
commit 973ef49b4f4384350e052400de372e9b136e72a3
Author: remm <re...@apache.org>
AuthorDate: Thu Apr 6 15:13:32 2023 +0200
Initialize Random during server initialization
BZ66554, causing possible thread creation by the JVM using the context
of the webapp.
---
java/org/apache/catalina/core/StandardServer.java | 5 +++++
webapps/docs/changelog.xml | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/java/org/apache/catalina/core/StandardServer.java b/java/org/apache/catalina/core/StandardServer.java
index eb5e91e932..720c639380 100644
--- a/java/org/apache/catalina/core/StandardServer.java
+++ b/java/org/apache/catalina/core/StandardServer.java
@@ -980,6 +980,11 @@ public final class StandardServer extends LifecycleMBeanBase implements Server {
reconfigureUtilityExecutor(getUtilityThreadsInternal(utilityThreads));
register(utilityExecutor, "type=UtilityExecutor");
+ // Initialize random generation of the JVM, as some platforms use
+ // a thread which could end up being associated with a webapp rather
+ // than the container.
+ (new Random()).nextInt();
+
// Register global String cache
// Note although the cache is global, if there are multiple Servers
// present in the JVM (may happen when embedding) then the same cache
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 3094946c56..111b9c4427 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -184,6 +184,11 @@
<bug>66543</bug>: Give <code>StandardContext#fireRequestDestroyEvent</code>
its own log message. (fschumacher)
</fix>
+ <fix>
+ <bug>66554</bug>: Initialize Random during server initialization to
+ avoid possible JVM thread creation in the webapp context on some
+ platforms. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: [tomcat] branch main updated: Initialize Random during server initialization
Posted by Rémy Maucherat <re...@apache.org>.
On Thu, Apr 6, 2023 at 3:18 PM Mark Thomas <ma...@apache.org> wrote:
>
> On 06/04/2023 14:14, remm@apache.org wrote:
> > This is an automated email from the ASF dual-hosted git repository.
> >
> > remm pushed a commit to branch main
> > in repository https://gitbox.apache.org/repos/asf/tomcat.git
> >
> >
> > The following commit(s) were added to refs/heads/main by this push:
> > new 973ef49b4f Initialize Random during server initialization
> > 973ef49b4f is described below
> >
> > commit 973ef49b4f4384350e052400de372e9b136e72a3
> > Author: remm <re...@apache.org>
> > AuthorDate: Thu Apr 6 15:13:32 2023 +0200
> >
> > Initialize Random during server initialization
> >
> > BZ66554, causing possible thread creation by the JVM using the context
> > of the webapp.
>
> Looks like this might belong in the JreMemoryLeakPreventionListener ?
For some reason, I forgot about that. Also, Random doesn't actually
use SeedGenerator (SecureRandom does). So I really need to put this in
JreMemoryLeakPreventionListener and disable it by default (no need to
consume precious random bytes for no reason ;) ).
Remy
> Mark
>
>
> > ---
> > java/org/apache/catalina/core/StandardServer.java | 5 +++++
> > webapps/docs/changelog.xml | 5 +++++
> > 2 files changed, 10 insertions(+)
> >
> > diff --git a/java/org/apache/catalina/core/StandardServer.java b/java/org/apache/catalina/core/StandardServer.java
> > index eb5e91e932..720c639380 100644
> > --- a/java/org/apache/catalina/core/StandardServer.java
> > +++ b/java/org/apache/catalina/core/StandardServer.java
> > @@ -980,6 +980,11 @@ public final class StandardServer extends LifecycleMBeanBase implements Server {
> > reconfigureUtilityExecutor(getUtilityThreadsInternal(utilityThreads));
> > register(utilityExecutor, "type=UtilityExecutor");
> >
> > + // Initialize random generation of the JVM, as some platforms use
> > + // a thread which could end up being associated with a webapp rather
> > + // than the container.
> > + (new Random()).nextInt();
> > +
> > // Register global String cache
> > // Note although the cache is global, if there are multiple Servers
> > // present in the JVM (may happen when embedding) then the same cache
> > diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
> > index 3094946c56..111b9c4427 100644
> > --- a/webapps/docs/changelog.xml
> > +++ b/webapps/docs/changelog.xml
> > @@ -184,6 +184,11 @@
> > <bug>66543</bug>: Give <code>StandardContext#fireRequestDestroyEvent</code>
> > its own log message. (fschumacher)
> > </fix>
> > + <fix>
> > + <bug>66554</bug>: Initialize Random during server initialization to
> > + avoid possible JVM thread creation in the webapp context on some
> > + platforms. (remm)
> > + </fix>
> > </changelog>
> > </subsection>
> > <subsection name="Coyote">
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: dev-help@tomcat.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: [tomcat] branch main updated: Initialize Random during server initialization
Posted by Mark Thomas <ma...@apache.org>.
On 06/04/2023 14:14, remm@apache.org wrote:
> This is an automated email from the ASF dual-hosted git repository.
>
> remm pushed a commit to branch main
> in repository https://gitbox.apache.org/repos/asf/tomcat.git
>
>
> The following commit(s) were added to refs/heads/main by this push:
> new 973ef49b4f Initialize Random during server initialization
> 973ef49b4f is described below
>
> commit 973ef49b4f4384350e052400de372e9b136e72a3
> Author: remm <re...@apache.org>
> AuthorDate: Thu Apr 6 15:13:32 2023 +0200
>
> Initialize Random during server initialization
>
> BZ66554, causing possible thread creation by the JVM using the context
> of the webapp.
Looks like this might belong in the JreMemoryLeakPreventionListener ?
Mark
> ---
> java/org/apache/catalina/core/StandardServer.java | 5 +++++
> webapps/docs/changelog.xml | 5 +++++
> 2 files changed, 10 insertions(+)
>
> diff --git a/java/org/apache/catalina/core/StandardServer.java b/java/org/apache/catalina/core/StandardServer.java
> index eb5e91e932..720c639380 100644
> --- a/java/org/apache/catalina/core/StandardServer.java
> +++ b/java/org/apache/catalina/core/StandardServer.java
> @@ -980,6 +980,11 @@ public final class StandardServer extends LifecycleMBeanBase implements Server {
> reconfigureUtilityExecutor(getUtilityThreadsInternal(utilityThreads));
> register(utilityExecutor, "type=UtilityExecutor");
>
> + // Initialize random generation of the JVM, as some platforms use
> + // a thread which could end up being associated with a webapp rather
> + // than the container.
> + (new Random()).nextInt();
> +
> // Register global String cache
> // Note although the cache is global, if there are multiple Servers
> // present in the JVM (may happen when embedding) then the same cache
> diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
> index 3094946c56..111b9c4427 100644
> --- a/webapps/docs/changelog.xml
> +++ b/webapps/docs/changelog.xml
> @@ -184,6 +184,11 @@
> <bug>66543</bug>: Give <code>StandardContext#fireRequestDestroyEvent</code>
> its own log message. (fschumacher)
> </fix>
> + <fix>
> + <bug>66554</bug>: Initialize Random during server initialization to
> + avoid possible JVM thread creation in the webapp context on some
> + platforms. (remm)
> + </fix>
> </changelog>
> </subsection>
> <subsection name="Coyote">
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org