commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1813444 - /commons/proper/daemon/trunk/src/native/windows/src/javajni.c
Date Thu, 26 Oct 2017 18:20:01 GMT
Author: markt
Date: Thu Oct 26 18:20:01 2017
New Revision: 1813444

URL: http://svn.apache.org/viewvc?rev=1813444&view=rev
Log:
Partial fix for DAEMON-302. This addresses JVM crashes with JNI mode.

Modified:
    commons/proper/daemon/trunk/src/native/windows/src/javajni.c

Modified: commons/proper/daemon/trunk/src/native/windows/src/javajni.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/windows/src/javajni.c?rev=1813444&r1=1813443&r2=1813444&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/windows/src/javajni.c (original)
+++ commons/proper/daemon/trunk/src/native/windows/src/javajni.c Thu Oct 26 18:20:01 2017
@@ -473,6 +473,14 @@ static void JNICALL __apxJniExit(jint ex
     return;
 }
 
+static void JNICALL __apxJniAbort()
+{
+    apxLogWrite(APXLOG_MARK_DEBUG "JVM aborted");
+    // Set the exit code to a non-zero value to indicate a non-standard exit
+    vmExitCode = 1;
+    return;
+}
+
 static LPSTR __apxStrIndexA(LPCSTR szStr, int nCh)
 {
     LPSTR pStr;
@@ -660,7 +668,8 @@ apxJavaInitialize(APXHANDLE hJava, LPCST
         if (szClassPath && *szClassPath)
             ++sOptions;
 
-        sOptions++; /* unconditionally set for extraInfo exit */
+        sOptions++; /* unconditionally set for extraInfo exit  */
+        sOptions++; /* unconditionally set for extraInfo abort */
 
         nOptions = __apxMultiSzToJvmOptions(hJava->hPool, lpOptions,
                                             &lpJvmOptions, sOptions);
@@ -685,6 +694,11 @@ apxJavaInitialize(APXHANDLE hJava, LPCST
         lpJvmOptions[nOptions - sOptions].extraInfo    = __apxJniExit;
         --sOptions;
 
+        /* unconditionally add hook for abort in order to store exit code */
+        lpJvmOptions[nOptions - sOptions].optionString = "abort";
+        lpJvmOptions[nOptions - sOptions].extraInfo    = __apxJniAbort;
+        --sOptions;
+
         if (dwMs) {
             wsprintfA(iB[0], "-Xms%dm", dwMs);
             lpJvmOptions[nOptions - sOptions].optionString = iB[0];



Mime
View raw message