Matlab deployed .exe won't shut down

Hello,
I want to run a deployed executable from Matlab code which does some calculations. The executable is deployed with the Matlab Compiler (-mcc command) and MATLAB 2020b. On my personal and other computers the executable runs well and is able to perform the calculation and can write the results to severeal ASCII-Files.
Now i want to run the executable on a Server under the "system" user (the matlab runtime is installed on the machine). Therefore, I encounter the problem that the .exe doesn't shut down after the main programm part. The command windows is still open. It is like, that the executable is stuck in some process and cannot be ended by the runtime. However the last line of my code is reached, because this is the console output with the calculation time. In the attached picutere the last output ist the last line of the code.
I am confused because the executable runs well on any computer except on the server. Do I have to compile the exe with an special compiler flag for the -mcc or do I have to register the exe in some way on the server that the runtime can end the executable well? Does somebody encoutered the same problem and can give some hints with this problem.
Best regards,
Jonas

4 comentarios

Thorsten Pesch
Thorsten Pesch el 27 de Abr. de 2021
Hi,
I have the exact same Problem. I had Matlab Runtime executables running on a Windows Server 2016 for a few months and suddenly they all stopped to shutdown correctly.
What I noticed is that there is a dependency to the creation of plots. Obviously I need to close all figures at the end of the execution. But now it's not enough to close the figures, but the scripts only terminate if I don't create any figures at all. But for some of my scripts I need to use the figures to create some images, which I want to save.
Is there any answer to this problem?
Best wishes!
Thorsten
Jonas Hochrein
Jonas Hochrein el 27 de Abr. de 2021
Hi Thorsten,
in my analysis I found out the same as you. Somehow the Matlab runtime opens a thread for every plot and doesn‘t close it afterwards. You can track the threads with the „dependency walker“. For my application the plots aren’t really necessary, so I compiled and .exe without the figures/plot cmds. But indeed it would be nice to get a proper solution.
Best regards
Thorsten Pesch
Thorsten Pesch el 28 de Abr. de 2021
Hi Jonas,
thanks for the hint with the dependency walker, I'll sure look into that!
For now I fixed my issue with the solution described here:
It's basically a force kill at the end of the execution. Not nice, but very effective...
William
William el 9 de Nov. de 2021
I have the same problem. I have tried various iterations of figure, uifigure, and closereqfunction. When I run an executable without plotting -- no problem. When I create a plot -- even a simple one, the exe file will not close on its own.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre MATLAB Compiler en Centro de ayuda y File Exchange.

Productos

Versión

R2020b

Preguntada:

el 25 de Nov. de 2020

Comentada:

el 9 de Nov. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by