필터 지우기
필터 지우기

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

조회 수: 4 (최근 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?

채택된 답변

Partha Saradhi
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개)

카테고리

Help CenterFile Exchange에서 Java Package Integration에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by