Skip to content

Check whether RAxML keeps running after the app closes, then confirm and abort on close #332

Done

Description

@jtklein-agents

Problem

Sentry issue RAXMLGUI2-2DH (TypeError: Object has been destroyed, raxmlGUI 2.0.17, Windows) shows RAxML stdout (Bootstrap[1076]) arriving in the main process after window.closed, window-all-closed, before-quit and will-quit. So a run was still alive after the user closed the window. Nothing in src/main/index.ts stops tracked runs on close or quit, and src/main/cancelRun.ts only kills a process when the renderer asks for a cancel.

The crash itself (unguarded event.sender.send in send, src/main/processHelpers.ts:61) is a separate fix and is not part of this ticket.

Step 1: research

Find out whether the RAxML binary keeps running after the application has been closed. Start a long run (a bootstrap analysis), close the window, and check the process list.

  • Windows, Linux: closing the last window calls app.quit(). Does the child process outlive the app process?
  • macOS: closing the last window leaves the app running. Does the run continue with no window, and what happens to it on Cmd+Q?
  • Cover every binary the app spawns through spawnProcess and trackRun: RAxML, RAxML-NG, ModelTest-NG, ASTRAL.

Post the findings per platform as a comment on this ticket. If no process survives on any platform and no run continues windowless, stop there and close the ticket with that comment.

Step 2: confirm on close (only if step 1 finds a surviving or windowless run)

When the user closes a window while one of its runs is in progress, show a dialog asking whether they really want to stop the run by closing the window.

  • Cancel keeps the window open and the run untouched.
  • Confirm goes to step 3.
  • No dialog when no run is in progress.
  • Quitting the app (Cmd+Q, menu Quit) with a run in progress asks the same question.

Step 3: abort the run

On confirm, stop every run that belongs to the closing window, using the existing cancelRun / stopRun path in src/main/cancelRun.ts, then let the window close. After the app quits, no spawned binary is left in the process list.

Acceptance criteria

  • A comment on this ticket states, per platform tested, whether each binary survives window close and app quit, and how that was checked.
  • Closing a window with a run in progress shows a confirmation dialog; Cancel leaves the window and run as they were.
  • Confirming kills the run's process and closes the window.
  • Closing a window with no run in progress shows no dialog.
  • After app quit, no RAxML, RAxML-NG, ModelTest-NG or ASTRAL process started by the app remains.
  • A test covers the close-with-running-run decision (dialog shown, cancel keeps the run, confirm stops it).

Not checked when filing

Process survival was inferred from the Sentry breadcrumbs only; it has not been reproduced. Only a Mac is available locally, so the Windows and Linux answers may need CI or a human.

Activity

  1. added
    ready-for-agent
    on Nov 23, 2026
  2. jtklein-agents commented on Nov 27, 2026

    @jtklein-agents
    OwnerAuthor

    Step 1 findings: does a run outlive the window or the app?

    Tested on macOS only (Apple Silicon, Electron from this repo). Windows and Linux were not tested: no machine was available.

    How it was checked

    A throwaway Electron main spawned each binary the way spawnProcess does (child_process.execFile, no shell on macOS). Each binary ran a long job on static/example-files/fasta/dna.txt:

    • raxmlHPC -f a -N 10000 (rapid bootstrap plus ML search)
    • raxml-ng --bootstrap --bs-trees 10000
    • modeltest-ng

    The script then called app.quit() after 3 s, and ps -o pid,ppid -p <pids> listed what was left. Two control children were added: /bin/sleep 60, which writes nothing, and a shell loop that prints a line every 5 s.

    macOS results

    Binary Survives window close Survives app quit
    RAxML (raxmlHPC) Yes: the app stays alive with no window (window-all-closed does not quit on darwin), so the run continues windowless. Only until its next stdout write. The child is reparented to launchd (PPID 1), and its next write to the closed pipe kills it with SIGPIPE. RAxML died within 2 s of quit, after bootstrap 1998.
    RAxML-NG Yes, same mechanism. Only until its next write. It died after bootstrap tree 505.
    ModelTest-NG Yes, same mechanism. Only until its next write. It died.
    ASTRAL (java -jar) Yes, same mechanism (same execFile path). Not checked. The jar is not in this checkout and the test Mac has no JRE. It goes through the same execFile path, so I expect the same behaviour, but that is unverified.
    Control: /bin/sleep (no output) — Survived the app (PPID 1).
    Control: prints every 5 s — Died at its next print.

    So on macOS, after quit a binary survives for as long as it stays silent, and it keeps using CPU in that time. A long single ML search on a big alignment can stay silent for a long time.

    Windows and Linux (not tested, inferred only)

    • Linux should behave like macOS (POSIX SIGPIPE), and window-all-closed calls app.quit() there, so closing the window equals quitting.
    • Windows has no SIGPIPE. A write to a closed pipe returns an error, and the binaries ignore it, so I expect them to keep running. The Sentry breadcrumbs (stdout after will-quit) fit this. Also, spawnProcess uses shell: true on Windows, so the tracked process is cmd.exe. proc.kill() (and therefore cancelRun) may kill only cmd.exe and leave the binary running. That would affect the normal Cancel button too. This needs a check on a real Windows machine.

    Steps 2 and 3

    Because runs survive on macOS (windowless, and silent ones after quit), steps 2 and 3 are implemented on branch 332-raxml-keeps-running-after-close. The real app was checked on macOS with Playwright and a stubbed dialog:

    • Closing the window during a ModelTest-NG run shows the dialog once. Cancel keeps the window and the modeltest-ng process.
    • Quit followed by Stop exits the app, and pgrep modeltest-ng finds nothing.
    • Closing with no run in progress shows no dialog.
  3. jtklein-agents commented on Nov 27, 2026

    @jtklein-agents
    OwnerAuthor

    Shipped in AntonelliLab#529 (merged as d740620). Still open: Windows (stopping a run may only kill cmd.exe because spawnProcess uses shell: true) and ASTRAL were not checked; see the findings comment above.

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

    ready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions