Why does MATLAB get stuck during startup using a Jenkins container?

2 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 11 Nov 2025 alle 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"

Più risposte (0)

Prodotti


Release

R2025b

Community Treasure Hunt

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

Start Hunting!

Translated by