Skip to content

Tolerate exiting processes in native application checks - #1161

Merged
zlareb1 merged 1 commit into
mainfrom
fix/dify-process-exit-race
Nov 22, 2026
Merged

zlareb1 merged 1 commit into
mainfrom
fix/dify-process-exit-race

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Related: #1153

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

Not required.

Why

A process can exit after its proc file is opened. Linux then raises ProcessLookupError while reading the file. The native application check treated only FileNotFoundError as a disappeared process, so an unrelated process exiting during a command's session census could abort an otherwise healthy fixture.

Scope and risk

Treat both missing-process errors as an absent observation in process identity, owner and RSS reads. Permission errors and other I/O failures still propagate. Session ownership, process generations, resource limits and cleanup authorization retain their existing checks.

Compatibility, rollout and rollback

  • Wire: none.
  • Operator steps: none.
  • Rollback: revert the harness and its regression tests; no stored data changes.

Tests

  • A deterministic Linux probe reproduced ESRCH by opening a child stat file, reaping the child and reading the open file.
  • Before the fix, the four new regressions produced three errors and one failure at the predicted observation paths.
  • .venv/bin/python -m unittest tests.unit.test_dify_application_guards: all 38 tests pass, including process reuse, orphan ownership, cleanup and monitor refusal controls.
  • Ruff format and lint pass for both changed files; git diff --check passes.
  • The native application check passed with no monitor error and verified cleanup. Its 38 guards and 65 subtests also passed.
  • All 53 checks on the reviewed head passed, including the full unit, coverage, integration and mixed-version CI.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Codex; checked the process observation paths, failure artifact and ownership controls.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Applicable local checks pass: Ruff format, lint and the focused guard tests. Full unit and integration results are reported by CI.
  • No generated files, migrations, plugin files, frontend files or documentation change.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers.
  • Commits are signed off (git commit -s).

Treat ESRCH from process observations as a vanished process. Keep permission and other I/O failures terminal, and preserve generation and session ownership checks.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
@vercel

vercel Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loom-docs Ready Ready Preview Nov 22, 2026 1:08pm UTC

Request Review

@zlareb1
zlareb1 merged commit c4f6085 into main Nov 22, 2026
53 checks passed
@zlareb1
zlareb1 deleted the fix/dify-process-exit-race branch November 22, 2026 14:43
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