Why does MATLAB get stuck during startup using a Jenkins container?
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 11 Nov. 2025
Beantwortet: MathWorks Support Team
am 14 Nov. 2025 um 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?
Akzeptierte Antwort
MathWorks Support Team
am 11 Nov. 2025
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 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!