Skip to content

Quit omc on every exit path and check for leftovers - #358

Merged
sjoelund merged 1 commit into
masterfrom
quit-omc-explicitly
Sep 9, 2026
Merged

Quit omc on every exit path and check for leftovers#358
sjoelund merged 1 commit into
masterfrom
quit-omc-explicitly

Conversation

@sjoelund

@sjoelund sjoelund commented Sep 9, 2026

Copy link
Copy Markdown
Member

Since f0c8470 testmodel.py has a daemon thread sampling memory, and on Python 3.14 a live daemon thread means no del runs at sys.exit. The main omc session was never quit explicitly and relied on OMPython's del, so from 2026-09-08 every test left its omc alive: ~19200 OOM kills per run and ~6000 models killed while loading, unchanged by c7a7b4d, which fixed the timeout path only.

quit_omc now waits for the session's processes and kills what does not exit; writeResultAndExit always quits both sessions and whatever is left below the script; an excepthook writes the result first.

OMPython receives with no timeout, so an omc killed mid-command left the main thread in a C-level recv where no signal handler runs: 194 models were charged the full outer timeout with no phase data. guardSession replaces sendExpression with one that polls and notices omc dying within a second.

test.py marks each test with OMLT_JOB= in the environment and scans /proc/*/environ afterwards (3 ms), killing and logging anything that survived. The Jenkins exit trap prints memory.stat and the largest processes.

Assisted-by: Claude Fable 5.1

Since f0c8470 testmodel.py has a daemon thread sampling memory, and
on Python 3.14 a live daemon thread means no __del__ runs at
sys.exit. The main omc session was never quit explicitly and relied
on OMPython's __del__, so from 2026-09-08 every test left its omc
alive: ~19200 OOM kills per run and ~6000 models killed while
loading, unchanged by c7a7b4d, which fixed the timeout path only.

quit_omc now waits for the session's processes and kills what does
not exit; writeResultAndExit always quits both sessions and whatever
is left below the script; an excepthook writes the result first.

OMPython receives with no timeout, so an omc killed mid-command left
the main thread in a C-level recv where no signal handler runs: 194
models were charged the full outer timeout with no phase data.
guardSession replaces sendExpression with one that polls and notices
omc dying within a second.

test.py marks each test with OMLT_JOB=<name> in the environment and
scans /proc/*/environ afterwards (3 ms), killing and logging anything
that survived. The Jenkins exit trap prints memory.stat and the
largest processes.

Assisted-by: Claude Fable 5.1
@sjoelund
sjoelund enabled auto-merge (squash) September 9, 2026 05:20
@sjoelund
sjoelund merged commit 0e966ff into master Sep 9, 2026
7 checks passed
@sjoelund
sjoelund deleted the quit-omc-explicitly branch September 9, 2026 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant