Skip to content

ADFA-4458 fix(proot): wait on the local process, not the shared currentProcess field#64

Merged
luisguzman-adfa merged 1 commit into
mainfrom
fix/ADFA-4458-prootengine-process-race
Jun 25, 2026
Merged

ADFA-4458 fix(proot): wait on the local process, not the shared currentProcess field#64
luisguzman-adfa merged 1 commit into
mainfrom
fix/ADFA-4458-prootengine-process-race

Conversation

@luisguzman-adfa

Copy link
Copy Markdown
Collaborator

ADFA-4458 — install button reports completion before runrole finishes

Cause (concurrency)

PRootEngine.executeInContainer / startInteractiveShell stored the running process in the shared instance field currentProcess and called waitFor() on that field. The install flow and other proot calls (fetchLocalVarsFromPRoot, verifyInstallationState, fired on DeployFragment lifecycle e.g. when switching tabs) use the same shared engine (host.prootEngine()). A concurrent proot call reassigns currentProcess, so a long install's waitFor() returns on the wrong (short-lived) process → onProcessExit fires early → the launch button reports "finished" while runrole is still running (Ansible workers orphaned, visible in the server log).

Pre-existing/latent — not introduced by the ADFA-4434 carve (verified: PRootEngine untouched; single shared engine instance both before and after). Distinct root cause from ADFA-4435.

Fix

Capture the process in a local variable per call and stream/waitFor() on the local; keep currentProcess = proc only so killProcess() targets the latest. Each execution now waits on its own process; concurrent proot calls no longer race.

Test on device

Start a module install, switch to Usage to watch the Server Log, switch back: the launch button must stay in "installing" until the role actually completes (no premature "finished").

Note (optional hardening, not in this PR)

Could also avoid firing fetchLocalVars/verify while isBatchInstalling, or serialize proot calls — tracked separately if wanted.

Relates to: ADFA-4435

…ntProcess field

executeInContainer/startInteractiveShell stored the process in the shared
instance field currentProcess and called waitFor() on the field. A concurrent
proot call on the same engine instance (e.g. fetchLocalVarsFromPRoot /
verifyInstallationState on fragment lifecycle) reassigned the field, so a long
install's waitFor returned on the wrong (short-lived) process and onProcessExit
fired early — the launch button reported completion while runrole was still
running. Capture the process in a local variable per call; keep currentProcess
only so killProcess targets the latest.

Ref: ADFA-4435
@luisguzman-adfa luisguzman-adfa merged commit 342811a into main Jun 25, 2026
1 check passed
@luisguzman-adfa luisguzman-adfa deleted the fix/ADFA-4458-prootengine-process-race branch June 25, 2026 21:11
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