Deployed Java package: MWMCROption.OUTPROC causes forrtl error (200) program aborting due to window-close event

9 visualizzazioni (ultimi 30 giorni)
I used Compiler SDK to package an m-file function as a Java package, which encompasses a class and a method. The external developer reported the following error message when shutting down Tomcat:
forrtl: error (200): program aborting due to window-CLOSE event
The message shows after shutting down Tomcat, appearing on the Tomcat console immediately before it closes. Oddly, it isn't written to the Tomcat logs. To the developer, it suggests that something isn’t getting closed properly.
The only thing found online is this unanswered question: https://www.mathworks.com/matlabcentral/answers/364024
In our case, however, the crash dump shows different DLLs from the question cited above:
libifcoremd.dll
KERNELBASE.dll
KERNEL32.DLL
ntdll.dll
After several repetitions of this, the developer was able to capture a picture of the crash dump on a smartphone:
We note that this error only occurs when the Java invoker uses "MWApplication.initialize(MWMCROption.OUTPROC)". Under multithreading, when the deployed class is instantiated within each thread, this causes the associated MCRs to run as independent processes in order to avoid conflicts.
When specifying "MWMCROption.OUTPROC", what else is needed to properly clean up and enable a proper shutdown?

Risposta accettata

Partha Saradhi
Partha Saradhi il 20 Mar 2024
To clean up all instances of MCR, you need to dispose of the class objects associated with an MCR runtime and releases all the runtime instances. This can be done using either a custom signal handler that catches the window-CLOSE event or a shutdown hook.
Alternatively, you could opt for the "mcc -S" option instead of the "MWMCROption.OUTPROC" option. Normally, each class instance gets its own MATLAB Runtime context. However, by using the "mcc -S" option, only one MATLAB Runtime instance is created and shared across all class instances. This shared instance and the Runtime wrapper class object will be managed by the shutdown hook for proper release. For more information about the "mcc -S" option, please refer to the documentation below:

Più risposte (0)

Categorie

Scopri di più su Java Package Integration in Help Center e File Exchange

Prodotti


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by