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 <r...@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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to