Maplesoft Open Maple Java Programming Interface : Bug Report 1
Subject
-------------------------------------------------------------
FATAL ERROR in native method: Using JNIEnv in non-Java thread
-------------------------------------------------------------
Unexpected and apparently inconsistent threading behaviour.
Perhaps due to default callback semantics ?
Hello Maplesoft Support team,
Environment
* Maple: Maple 2024.2 (build used in our tests) Build ID #18723373
* OS: macOS (Apple Silicon / arm64) Sequoia 15.7.1 32 GB
* uname output from the failing machine: Darwin Mac-Mini.local 24.6.0 Darwin Kernel Version 24.6.0: Mon Aug 11 21:16:30 PDT 2025; root:xnu-11417.140.69.701.11~1/RELEASE_ARM64_T8132 arm64
* JDK: openjdk 21.0.8 2025-07-15 LTS (Temurin 21.0.8+9)
* Maple Java jars in use:
* /Library/Frameworks/Maple.framework/Versions/2024/java/jopenmaple.jar
* /Library/Frameworks/Maple.framework/Versions/2024/java/externalcall.jar
* Native libraries loaded from:
* /Library/Frameworks/Maple.framework/Versions/2024/bin.APPLE_ARM64_MACOS
Exact java command used to run OpenMapleBug1:
java -Xcheck:jni --enable-native-access=ALL-UNNAMED -Xrs \
-cp .:/Library/Frameworks/Maple.framework/Versions/2024/java/jopenmaple.jar:/Library/Frameworks/Maple.framework/Versions/2024/java/externalcall.jar \
-Djava.library.path=/Library/Frameworks/Maple.framework/Versions/2024/bin.APPLE_ARM64_MACOS \
OpenMapleBug1
Minimal Java reproducer:
import com.maplesoft.openmaple.*;
import com.maplesoft.externalcall.MapleException;
import java.util.*;
public class OpenMapleBug1
{
public static void main(String[] args) throws Exception
{
String[] mapleArgs = { "java" };
try
{
Engine engine = new Engine(mapleArgs, new EngineCallBacksDefault(), null, null);
String expr1 = "diff( tan( x )/exp( x ), x );";
String expr2 = "u_general := sum(B[n] * sin(n*Pi*x/L) * exp(-alpha*(n*Pi/L)^2*t), n=1..infinity);";
System.out.println("Evaluating: " + expr1);
engine.evaluate(expr1);
System.out.println("Evaluating: " + expr2);
engine.evaluate(expr2);
System.out.println("Success");
}
catch (MapleException e)
{
System.out.println("Error: " + e);
e.printStackTrace();
}
}
}
Observed Behaviour
Two calls are made to OpenMaple. The first succeeds:
Evaluating: diff( tan( x )/exp( x ), x );
(1+tan(x)^2)/exp(x)-tan(x)/exp(x)
The second fails (cf. OpenMapleBug2 (which is actually my main line of investigation); also submitted).
Evaluating: u_general := sum(B[n] * sin(n*Pi*x/L) * exp(-alpha*(n*Pi/L)^2*t), n=1..infinity);
FATAL ERROR in native method: Using JNIEnv in non-Java thread
zsh: abort java -Xcheck:jni --enable-native-access=ALL-UNNAMED -Xrs -cp OpenMapleBug1
=========================================
Suggested actions for Maplesoft engineers
=========================================
* Reproduce on macOS Apple Silicon using the provided reproducer and command line.
* Check whether this regression is present on other platforms (x86 mac, Linux) and JDK versions.
* Provide a fix for Maple 2024.2 (and Maple 2025.x if applicable).
Thank-you.
Maplesoft Open Maple Java Programming Interface : Bug Report 2
Subject
Native crash (SIGSEGV) in libmaple.dylib when evaluating symbolic sum with indexed coefficients (B[n]) — macOS Apple Silicon — Maple 2024.2
Hello Maplesoft Support team,
I’m reporting a native crash (SIGSEGV) inside libmaple.dylib that occurs when evaluating a symbolic sum containing indexed symbolic coefficients (for example B[n]) via the Maple Java Engine API (jopenmaple). The crash aborts the JVM and produces hs_err_pid34602.log. This is available: email me to receive it.. Rewriting the indexed symbol as a function (for example B(n)) avoids the crash, which suggests a native bug in Maple’s handling of indexed symbolic objects during summation/conversion/evaluation.
Please find environment, exact commands, a minimal reproducer, hs_err_pid34602.log (email), and suggested tests and actions below.
Environment
* Maple: Maple 2024.2 (build used in our tests) Build ID #18723373
* OS: macOS (Apple Silicon / arm64) Sequoia 15.7.1 32 GB
* uname output from the failing machine: Darwin Mac-Mini.local 24.6.0 Darwin Kernel Version 24.6.0: Mon Aug 11 21:16:30 PDT 2025; root:xnu-11417.140.69.701.11~1/RELEASE_ARM64_T8132 arm64
JDK: openjdk 21.0.8 2025-07-15 LTS
OpenJDK Runtime Environment Temurin-21.0.8+9 (build 21.0.8+9-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.8+9 (build 21.0.8+9-LTS, mixed mode, sharing)
Maple Java jars in use:
* /Library/Frameworks/Maple.framework/Versions/2024/java/jopenmaple.jar
* /Library/Frameworks/Maple.framework/Versions/2024/java/externalcall.jar
Native libraries loaded from:
* /Library/Frameworks/Maple.framework/Versions/2024/bin.APPLE_ARM64_MACOS
Exact java command used to run MinimalSumTest2:
java -Xcheck:jni --enable-native-access=ALL-UNNAMED -Xrs \
-cp .:/Library/Frameworks/Maple.framework/Versions/2024/java/jopenmaple.jar:/Library/Frameworks/Maple.framework/Versions/2024/java/externalcall.jar \
-Djava.library.path=/Library/Frameworks/Maple.framework/Versions/2024/bin.APPLE_ARM64_MACOS \
MinimalSumTest2
Note: Adding -Xss100M did not make any apparent difference.
Minimal Java reproducer (attach as MinimalSumTest2.java):
// MinimalSumTest2.java
public class MinimalSumTest2
{
public static void main(String[] args)
{
String[] mapleArgs = new String[] { "java" }; // some versions require this
com.maplesoft.openmaple.Engine engine = null;
try
{
System.out.println("Creating Engine...");
engine = new com.maplesoft.openmaple.Engine(
mapleArgs,
new com.maplesoft.openmaple.EngineCallBacksDefault(),
null,
null
);
// assign with ":" to suppress printing (should avoid large marshalled result)
String assignSuppressed = "u_test := sum(B[n]*sin(n*Pi*x/L)*exp(-alpha*(n*Pi/L)^2*t), n=1..100):";
System.out.println("Evaluating (suppressed): " + assignSuppressed);
engine.evaluate(assignSuppressed);
System.out.println("Assigned (suppressed) OK");
System.out.println("Done.");
} catch (Throwable t)
{
System.err.println("Unexpected throwable (may be native crash):");
t.printStackTrace();
// If a SIGSEGV occurs, JVM may abort before this runs; look for hs_err_pid*.log
} finally
{
// no stop() method available
}
}
}
Observed Behavior
* JVM aborts with SIGSEGV in native code (libmaple.dylib). The hs_err log shows frames in:
* libmaple.dylib : errorJmp(_ThreadLocalData*) / extIsNumeric
* libjopenmaple.jnilib : newAlgebraic / Java_com_maplesoft_openmaple_Engine_evaluate
* Using B(n) (function form) instead of B[n] or substituting numeric coefficients avoids the crash.
Attached crash evidence
* hs_err_pid34602.log is available: email me to receive it.
* Please use the full hs_err file for diagnostics; it contains native frames, thread state and loaded libraries.
Suggested quick tests to run (please include pass/fail for each):
1. Replace indexed form with function form:
* B := n -> b^n: u := sum(B(n)*sin(...), n=1..100): — does this crash?
2. Reduce N (small upper bound):
* sum(B[n]*sin(...), n=1..10): — crash or not?
3. Use a table in place of indexed name: Btab := table():
4. for k from 1 to 100 do Btab[k] := b || k od:
5. sum(Btab[n]*sin(...), n=1..100):
6. Pre-substitute a simple expression for B[n] before summing:
* sum(subs(B[n]=1/n, B[n]*sin(...)), n=1..100):
7. Try same reproducer on a non-Apple-Silicon mac or Linux (if available) and with JDK 17.
Suggested cause (based on hs_err frames):
* Crash appears to occur in native routines that check numeric-ness / build algebraic objects (functions such as extIsNumeric and newAlgebraic). This indicates a bug in Maple’s native handling/conversion of indexed symbolic objects in sum/convert/evaluate code paths.
Temporary workarounds
* Use function form: B := n -> ... and B(n) in sums rather than B[n].
* Substitute definitions for B[n] before summation (client-side or via subs) so that the sum does not carry an indexed symbolic name into the conversion step.
* Build sums client-side (Java/Clojure) or use explicit truncated numeric sums when possible.
Files to attach (recommended)
* hs_err_pid*.log (full file)
* MinimalSumTest.java (the Java reproducer above)
* README_cmd.txt (contains exact javac and java commands used)
* java_version.txt (output of java --version)
* maplesoft_jars_list.txt (paths to jopenmaple.jar and externalcall.jar used)
=========================================
Suggested actions for Maplesoft engineers
=========================================
* Email me to receive the error log file produced for the crash.
* Reproduce on macOS Apple Silicon using the provided reproducer and command line.
* Inspect handling of indexed name objects inside summation/conversion code paths — particularly code interacting with extIsNumeric, newAlgebraic, and conversion routines invoked by Engine.evaluate.
* Check whether this regression is present on other platforms (x86 mac, Linux) and JDK versions.
* Provide either a patch that prevents this conversion path from dereferencing invalid memory, or return a safe Maple-level error for unsupported symbolic forms.
Thank-you.