termination command `kill -9 {id}` no longer works (from 2022b to 2024b)

2 views (last 30 days)
My HPC (unix/slurm) used to have matlab 2022b, on which the kill -9 command works well to terminate a job upon completion.
self.call_args = re.sub(r'\s+', ' ', '''"
diary('{0}');
addpath('{1}');
try,
{3},
rc = 0,
catch me,
fprintf('%s: %s\\n', me.identifier, me.message),
rc = 1,
end,
diary off;
fileID = fopen('{2}', 'w');
if rc,
fprintf(fileID, '{2} failed; see log file'),
else,
fprintf(fileID, '{2} run successfully'),
end,
fclose(fileID);
id = feature('getpid');
if ispc,
cmd = sprintf('taskkill /pid %d /f',id),
elseif (ismac || isunix),
cmd = sprintf('kill -9 %d',id),
else,
error('unknown operating system'),
end,
system(cmd);
exit(0);
"'''.format(norm_log, norm_base, self.exec_file, source_exec), flags = re.MULTILINE)
However, since the upgrade to 2024b, the command no longer works and matlab would hang upcome completion of a job.
I'm trying to understand what changed across the two versions.
One candidate is “MathWorks Service Host” which could have been introduced just now:
> Starting from R2024a, all MATLAB installations require MathWorks Service Host.
But matlab’s official release notes don’t mention whether the unix version turned on the feature from 2022b to 2024b. So I'm not sure, so coming here for ideas.

Answers (1)

Steven Lord
Steven Lord on 7 Jun 2025
Rather than killing the process, why not just call quit to exit MATLAB?

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2024b

Community Treasure Hunt

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

Start Hunting!