Skip to content

fix(app): make every hang leave a sample or the reason there is none, and stop ending an app that came back - #385

Merged
GeiserX merged 7 commits into
mainfrom
fix/hang-leaves-a-sample
Oct 10, 2026
Merged

GeiserX merged 7 commits into
mainfrom
fix/hang-leaves-a-sample

Conversation

@GeiserX

@GeiserX GeiserX commented Oct 10, 2026

Copy link
Copy Markdown
Owner

The app stopped answering four times in three days on my Mac, and the watchdog ended it each time without leaving a sample. The hangs folder held nothing, and the log did not say why.

The watchdog gave sample 5 s and waited on it. Under load that was never enough, and a sample that was cut short said nothing. Twice the app's thread wrote to the log again while the watchdog waited, and it was ended anyway.

What changes:

  • The sample runs beside the watchdog for up to 20 s. The log then says where the file is and where the main thread was, or why there is no sample.
  • A second line gives the load average and how late the watchdog's own ticks ran. Ticks seconds late mean the whole process was starved, not one thread stuck.
  • A thread that answers before the sample is done is not ended.

The cause of the four hangs is not found. What the logs show: three came within about a minute of a load average of 60 to 97 on that Mac, and the fourth three and a half minutes before one. A scratch app idle for 13 minutes on a generated library of 5,000 calls never answered slower than 10 ms, so a library scan is not it as far as measured. The next hang will carry the evidence.

Stacked on #384, which changes the same file. Merge that one first; this diff then shrinks to its own commit.

…f akou

The release wrapper unpacks the app on its first open, opens it again and
then waits on an "Installation complete" panel for a click on Close. While
it waits it is a launcher with no app below it, and open, the Dock and
Finder take it for the running app and start nothing. When the watchdog
ended a hung app and ran open -a, that is what happened, and akou stayed
down until someone noticed.

- The build writes ELECTROBUN_INSTALLER_UI_AUTOCLOSE=1 into the wrapper's
  LSEnvironment, so the wrapper exits once it has opened the unpacked app.
- The watchdog's reopen is a process of its own: it stops the bundle's
  launchers left with nothing below them, opens with open -n -a, waits for
  the new app to answer, tries once more, and writes the outcome to app.log.
- The app stops such launchers of its own bundle when it starts.
- A child that exited and was never reaped is not a process below a
  launcher. The real wrapper always has one, the open it ran, so the
  cleanup akou start had never stopped a real wrapper.
- The release job opens the built zip for the first time and fails when a
  launcher is left behind.
…e thread came back

Four hangs on a daily-use Mac left nothing in hangs/ and no word about
it. The watchdog gave the sample 5 s and waited on it; under a load
average of 60 to 97 that was never enough, a cut sample said nothing,
and an app whose thread answered again during the wait was ended anyway.

- The sample runs beside the watchdog for at most 20 s. The log gets
  where it is and the main thread's innermost named frames, or why there
  is no sample.
- A second line gives the load average and how late the watchdog's own
  ticks ran, which tells a starved machine from a stuck thread.
- A thread that answers before the sample is done is not ended.

What held the thread those four times is not known.
@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 47 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: GeiserX/akou/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1886bad5-c693-4de8-b411-c889aaa6a853

📥 Commits

Reviewing files that changed from the base of the PR and between 8bf9797 and f45162a.


📒 Files selected for processing (6)
  • docs/TRAPS.md
  • docs/ux/DESKTOP.md
  • src/main/watchdog.ts
  • tests/fixtures/fake-sampler.ts
  • tests/fixtures/watchdog-app.ts
  • tests/watchdog.test.ts

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@GeiserX
GeiserX merged commit 765aeea into main Oct 10, 2026
29 checks passed
@GeiserX
GeiserX deleted the fix/hang-leaves-a-sample branch October 10, 2026 11:42
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