Deployed Java package: MWMCROption.OUTPROC causes forrtl error (200) program aborting due to window-close event
9 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
Partha Saradhi
2024-3-20
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:
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Java Package Integration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!