mirror of
https://github.com/nmasur/dotfiles
synced 2026-11-18 18:19:14 +00:00
starship/jj: set WATCHMAN_SOCK to avoid slow watchman CLI lookup, raise command_timeout
This commit is contained in:
1 parent
a17cb837b0
commit
b0d5e699c8
3 files changed
+17
No files matched your search
@@ -1,5 +1,11 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2026-11-18: fix starship jj timeout warnings (slow watchman client startup)
|
||||||
|
|
||||||
|
- **Root cause**: starship's jj modules run `jj` several times per prompt, each snapshotting the working copy. With `fsmonitor.backend = "watchman"`, jj's watchman client resolves the socket by running `watchman get-sockname` on every command, and the watchman CLI takes ~110ms just to start (even `watchman --help`). The server itself answers in ~0.4ms. In `platform-api` this made `jj log -r @` take ~140ms (vs ~30ms with no fsmonitor), and parallel jj modules contending for the working-copy lock pushed prompts past starship's 500ms default, logging `Executing command "jj" timed out`.
|
||||||
|
- **`jujutsu.nix`**: On Darwin, set `WATCHMAN_SOCK` to the server socket so jj skips the CLI lookup (140ms -> 30ms, watchman stays enabled). Caveat: jj can no longer auto-start the watchman server; if it isn't running, jj silently falls back to a full scan.
|
||||||
|
- **`starship.nix`**: Raised `command_timeout` to 2000ms as a safety net for large snapshots.
|
||||||
|
|
||||||
## 2026-11-16: fix occasional terminal crash on zellij switch-session
|
## 2026-11-16: fix occasional terminal crash on zellij switch-session
|
||||||
|
|
||||||
- **Root cause**: the zellij 0.45.1 client leaks one socketpair (2 fds) per `switch-session`. Reproduced with two throwaway sessions: 10 → 33 fds over 12 switches. A client lives as long as its Ghostty window, and macOS gives GUI-launched processes a soft `RLIMIT_NOFILE` of 256 (`launchctl limit maxfiles`). After ~120 switches the client hits EMFILE. Its `assert_socket` liveness probe of the target then fails, so it treats the session as dead and spawns a new server under the same name. That server takes over the socket path, which orphans the real server (still running but unreachable). The new server then panics at `zellij-utils/src/ipc.rs:409` with "Too many open files" and the terminal exits. The log showed this signature three times (2026-11-08, 11-09, 11-16), and each one left a pair of servers sharing a socket name.
|
- **Root cause**: the zellij 0.45.1 client leaks one socketpair (2 fds) per `switch-session`. Reproduced with two throwaway sessions: 10 → 33 fds over 12 switches. A client lives as long as its Ghostty window, and macOS gives GUI-launched processes a soft `RLIMIT_NOFILE` of 256 (`launchctl limit maxfiles`). After ~120 switches the client hits EMFILE. Its `assert_socket` liveness probe of the target then fails, so it treats the session as dead and spawns a new server under the same name. That server takes over the socket path, which orphans the real server (still running but unreachable). The new server then panics at `zellij-utils/src/ipc.rs:409` with "Too many open files" and the terminal exits. The log showed this signature three times (2026-11-08, 11-09, 11-16), and each one left a pair of servers sharing a socket name.
|
||||||
|
|||||||
@@ -57,6 +57,14 @@ in
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# jj's watchman client runs `watchman get-sockname` on every command, and the
|
||||||
|
# watchman CLI takes ~110ms just to start. Pointing it at the socket directly
|
||||||
|
# skips that (jj log: 140ms -> 30ms). Caveat: jj then can't auto-start the
|
||||||
|
# watchman server; if it isn't running, jj silently falls back to a full scan.
|
||||||
|
home.sessionVariables = lib.optionalAttrs pkgs.stdenv.isDarwin {
|
||||||
|
WATCHMAN_SOCK = "${config.home.homeDirectory}/.local/state/watchman/${config.home.username}-state/sock";
|
||||||
|
};
|
||||||
|
|
||||||
home.packages = [
|
home.packages = [
|
||||||
# Required for the fsmonitor to auto-snapshot
|
# Required for the fsmonitor to auto-snapshot
|
||||||
pkgs.watchman
|
pkgs.watchman
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ in
|
|||||||
enableTransience = true; # Replace previous prompts with custom string
|
enableTransience = true; # Replace previous prompts with custom string
|
||||||
settings = {
|
settings = {
|
||||||
add_newline = false; # Don't print new line at the start of the prompt
|
add_newline = false; # Don't print new line at the start of the prompt
|
||||||
|
# Default is 500ms. The jj modules snapshot the working copy, which can
|
||||||
|
# exceed that in large repos (e.g. platform-api) and logs WARN timeouts.
|
||||||
|
command_timeout = 2000;
|
||||||
format = lib.concatStrings [
|
format = lib.concatStrings [
|
||||||
"$directory"
|
"$directory"
|
||||||
"$git_branch"
|
"$git_branch"
|
||||||
|
|||||||
Reference in new issue
Block a user