Repository navigation
fix(tauri): detect and respawn a dead Marlin subprocess; kill on drop - #175
Merged
Merged
Conversation
acquire_io used guard.is_none(), so once a MarlinSubprocess was stored it was reused forever even after the helper process had exited — every stdin write then failed with a broken pipe and it never recovered without an app restart. Detect an exited child via try_wait() and reset the state so the next command respawns. Also add Drop to kill+reap the child so it does not linger as an orphan holding the serial port after close/reload or replace. Tests cover the child_has_exited predicate for finished and running processes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug R2 from the latent-bug audit (subprocess lifecycle; merges T2 + T4).
Problem
acquire_iogated spawning onguard.is_none(). Once aMarlinSubprocesswas stored it was handed back forever — even after the helper process had exited — so everystdinwrite failed with a broken pipe and the integration never recovered without an app restart.MarlinSubprocessheld theChildas_childwith noDrop, so the interactive Python process was never killed — on app close/reload it lingered as an orphan holding the serial port open, blocking the next session.Fix
child_has_exited()(non-blockingtry_wait());acquire_ioresets the state toNonewhen the current subprocess is dead, so the next command respawns a fresh one.impl Drop for MarlinSubprocesstokill()+wait()the child, so it's reaped on shutdown and when a dead instance is replaced (no orphan / port leak).Test (runs in CI via the new cargo-test step)
child_has_exited_true_for_finished_process(spawnstrue, waits, asserts dead) andchild_has_exited_false_for_running_process(spawnssleep 30, asserts alive). Theacquire_iowiring andDropare verified by inspection (constructing a realMarlinSubprocessneeds the bundled CLI).