Why does MATLAB get stuck during startup using a Jenkins container?
조회 수: 1 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2025년 11월 11일 0:00
답변: MathWorks Support Team
2025년 11월 14일 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?
채택된 답변
MathWorks Support Team
2025년 11월 11일 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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!