Why does MATLAB get stuck during startup using a Jenkins container?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 11 de Nov. de 2025 a las 0:00
Respondida: MathWorks Support Team
el 14 de Nov. de 2025 a las 19:58
I am using Jenkins to start MATLAB R2025b in an Ubuntu container, using a wrapper script that uses the "-batch" startup flag. When I run this script, it gets stuck on a line that calls the "renderinfo" function. Similarly, if I call the "plot" function in my wrapper script, it also gets stuck. I am initializing my environment variables for the container as shown below:
### Init Environment
HOME=/runner
JENKINS_ROOT="$HOME/$JOBID"
. "$HOME/.profile"
TMPDIR="/tmp"
mkdir -p "$JENKINS_ROOT"
export HOME JENKINS_ROOT TMPDIR
cd "$JENKINS_ROOT"
Why does MATLAB freeze during this startup process and how can I resolve this?
Respuesta aceptada
MathWorks Support Team
el 11 de Nov. de 2025 a las 0:00
When setting environment variables for the container, the variable "TMPDIR" must be set and exported before sourcing ".profile".
This is because MATLAB incorporates an "autostart at login" functionality, which optimizes startup by starting MathWorks Service Host (MSH) when ".profile" is sourced. Therefore, in this case, MSH is started even though MATLAB is started up through batch. When "TMPDIR" is changed after MSH is started, MSH launches with a different "TMPDIR" to MATLAB, so MATLAB is unable to communicate with MSH, causing the freeze.
Our recommendation is to override any environment variables as early as possible, before any other processes are started. In this case, set and export "TMPDIR" first before initializing other processes:
### Init Environment
TMPDIR="/tmp"
export TMPDIR
HOME=/runner
export HOME
JENKINS_ROOT="$HOME/js"
export JENKINS_ROOT
. "$HOME/.profile"
mkdir -p "$JENKINS_ROOT"
cd "$JENKINS_ROOT"
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!