Skip to content

Closing StemDeck on Windows during GPU setup leaves pip or Python running #960

Closed

Description

@thcp

Problem

On Windows only the backend ran inside a job object that ends with the app. The pip run that installs CUDA torch and the model warmup (the first model download) did not. Closing the window in the middle left them running, still writing into python\ or the model cache. A relaunch could then start a second install, or restore the torch backup underneath the first one.

Who is affected: Windows desktop users who close StemDeck during GPU setup or the first model download.

Related: #140 (the earlier issue about an orphaned pip on window close; Windows still had this gap). PR #897 also carries a separate portable folder fix for #399.

Where

  • desktop/src-tauri/src/main.rs:2070 run_setup_child (starts the child in a job at :2092)
  • desktop/src-tauri/src/main.rs:3684 spawn_pip
  • desktop/src-tauri/src/main.rs:1979 warmup_models
  • desktop/src-tauri/src/backendjob.rs:120 spawn_in_job (Windows)

Current state

Fixed in PR #897 (merged into big-release, ships with 0.21.0).
Still to check by hand on Windows: close the window during a CUDA install or the first model download, then confirm in Task Manager that no python.exe or pip process is left.

Proposed fix

What the merged fix does: pip and the model warmup start through run_setup_child, which starts the child in a kill-on-close job (backendjob::spawn_in_job) and holds the job while it runs. Windows closes the job when StemDeck exits in any way, which ends the child and anything it started. One setup child runs at a time, and none starts once the window is closing.

Verification

  • cargo test --manifest-path desktop/src-tauri/Cargo.toml what_a_setup_child_starts_does_not_outlive_it
  • cargo test --manifest-path desktop/src-tauri/Cargo.toml closing_the_window_mid_setup_ends_the_setup_child
  • cargo test --manifest-path desktop/src-tauri/Cargo.toml no_setup_child_starts_once_the_window_is_closing
  • The manual check above.

Activity

  1. added
    bugSomething isn't working
    reliabilityStability, resource management, race conditions
    on Nov 3, 2026
  2. thcp commented on Nov 3, 2026

    @thcp
    CollaboratorAuthor

    This is fixed in PR #897, merged into big-release. It ships with 0.21.0, so I am closing this issue now.

    This comment was written with the help of AI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreliabilityStability, resource management, race conditions

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions