This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-daemon.git


The following commit(s) were added to refs/heads/master by this push:
     new 19baea3  Fix DAEMON-451 - Use configured stack size for main thread 
(kkolinko)
19baea3 is described below

commit 19baea32b142c27f98d48336900b394a9240cce5
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Apr 19 10:46:35 2023 +0100

    Fix DAEMON-451 - Use configured stack size for main thread (kkolinko)
---
 src/changes/changes.xml          | 6 ++++++
 src/native/windows/src/javajni.c | 7 ++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index e103933..0d8d00f 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -41,6 +41,12 @@
   </properties>
   <body>
     <release version="1.3.4" date="TBD" description="Bug fix release">
+      <!-- Fix -->
+      <action issue="DAEMON-451" type="fix" dev="markt" due-to="kkolinko">
+        Procrun. Configured stack size now applies to the main thread when
+        running in JVM mode.
+      </action>
+      <!-- UPDATES -->
       <action type="update" dev="ggregory" due-to="Dependabot">Bump 
commons-parent from 54 to 55 #71.</action>
     </release>
     <release version="1.3.3" date="2022-11-29" description="Bug fix release">
diff --git a/src/native/windows/src/javajni.c b/src/native/windows/src/javajni.c
index e541e40..1aad2e1 100644
--- a/src/native/windows/src/javajni.c
+++ b/src/native/windows/src/javajni.c
@@ -1105,13 +1105,18 @@ apxJavaStart(LPAPXJAVA_THREADARGS pArgs)
     lpJava = APXHANDLE_DATA(pArgs->hJava);
     if (!lpJava)
         return FALSE;
+    if (pArgs->dwSs) {
+        /* dwSS is measured in Kb, szStackSize in bytes */
+        lpJava->szStackSize = (SIZE_T) (pArgs->dwSs * 1024);
+    }
     lpJava->dwWorkerStatus = 0;
     lpJava->hWorkerInit    = CreateEvent(NULL, FALSE, FALSE, NULL);
     lpJava->hWorkerSync    = CreateEvent(NULL, FALSE, FALSE, NULL);
     lpJava->hWorkerThread  = CreateThread(NULL,
                                           lpJava->szStackSize,
                                           __apxJavaWorkerThread,
-                                          pArgs, CREATE_SUSPENDED,
+                                          pArgs,
+                                          CREATE_SUSPENDED + 
STACK_SIZE_PARAM_IS_A_RESERVATION,
                                           &lpJava->iWorkerThread);
     if (IS_INVALID_HANDLE(lpJava->hWorkerThread)) {
         apxLogWrite(APXLOG_MARK_SYSERR);

Reply via email to