Repository navigation
End event waits when their daemon dies, and keep followers idle (#218) - #219
Merged
Merged
Conversation
Main already fixed most of #218: followers ignore their own reads (ad48f88), animated titles are no longer logged (d5e370c), options may follow the session name (ad48f88), and a wait ends when its session exits or is removed (#197). Four gaps remained. - A token pty events did not know ended option parsing silently, and every option after it was dropped. pty events NAME --wait T --timeout=60 waited forever with no deadline. Such a token is now an error: Unexpected argument: <token>, exit 1. - A wait or named follow whose daemon died without recording an exit (SIGKILL, OOM, a host restart) never ended without -t. The follower now retires a session whose daemon recorded its pid and has vanished, unless a respawn holds the creation lock. A record that no daemon has claimed yet keeps waiting, since its launcher may still start it. - A session_exit wait reports "vanished without a recorded exit". - Other waits report "vanished before a <type> event was observed". - A named follow ends with 0. - Every write in the shared registry directory woke every follower. A named follower now wakes only for its sessions' logs and metadata, and --all only for logs. The 250 ms poll still covers missed notifications. - A wait that matched exited up to 250 ms later, because stop() waited for the follower's next poll. stop() now wakes it.
pty events now refuses an argument it does not know, where Node ignores everything after the session name and Rust before ignored everything after the unknown token. Decision 0021 records the departure, measured against the pinned Node build and main. parity.md gets a row. No conformance test passes pty events an unknown argument, so the ledger needs no entry. When an unknown dash token comes before the name (--timeout=60 NAME), the error now names that token instead of the name after it. A lone unknown dash token is still taken as the name, as in Node.
Contributor
Author
|
Independent read GO at exact head Read:
Release note: Risks (low):
|
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.
Fixes the part of #218 that main still has. The diagnosis, with what main already fixed, is on the issue.
What was left on main
8dd3fd42pty events NAME --wait T --timeout=60waited with no deadline, forever. So did-t=60,--wait=Tand any typo. Such a token is now an error,Unexpected argument: <token>, with exit 1. This matchespty send's message.--timeout=60 NAME), the error names that token. A lonepty events --bogusstill saysSession "--bogus" not found., as in Node.docs/parity.md.pty eventsan unknown argument. I listed everyeventsargv incrates/pty-conformance/tests.-t, the wait ran forever.session_exitwait reportsSession "NAME" vanished without a recorded exit., which is the startup check's message. Other waits reportSession "NAME" vanished before a "T" event was observed.Both exit 1, and a named follow ends with 0.<id>.events.jsonland<id>.json, and--allonly for logs. A notification without paths still wakes, and the 250 ms poll still covers anything a notification misses.EventFollower::stoponly set a flag, which the thread read at its next poll. On main, other sessions' writes often woke it first. Item 3 removes those wake-ups, which made the delay show every time.stopnow wakes the thread.Overlap with #201 (draft). #201 covers item 2 for
session_exitwaits only, with an opt-in flag that classifies the session on every scan. Here the rule applies to every named follower. A record that no daemon has claimed is still not treated as dead, which is what kept #201 to lifecycle waits. #201's two tests pass unchanged on this branch, its messages included.Not changed
session_exitalso reads recorded state (fix: complete event waits from session lifecycle state #197). The README states this contract, and changing it is a separate decision.events.jsonlor<id>.jsonchanges. The follower only reads them.Measured on Linux, debug builds. Each run used a fresh registry with 20 sessions that set their title and rang the bell every 100 ms (
load.sh, about 195 logged events/s):8dd3fd42user.*waiter,-t 6, under the loadpty emitreturns (8 runs)user.*waitsession_exitwaitNAME --wait T --timeout=2Unexpected argument: --timeout=2The reported build
063ff7fspun at 10.9 s CPU in 9.6 s with no load at all, and five waiters used 29.5 s in 8 s. Main fixed that in ad48f88.Tests
cli_events::an_unexpected_argument_is_refused_rather_than_dropping_the_options_after_it: seven spellings, each exiting 1 at once with the exact message.cli_events::waits_and_follows_end_when_their_daemon_vanishes: a real daemon, SIGKILLed. Auser.*wait, asession_exitwait and a named follow, each started once before the kill and once after, all end within 3 s with the expected status and message. The kept case, a record no daemon claimed, iswait_prints_the_first_matching_event_or_times_out, which still runs to its timeout.events::follow::tests::only_changes_to_followed_files_wake_the_follower: other sessions' logs and metadata, temporary files and pid files don't wake a named follower; its own log and metadata, and a notification with no paths, do.--allwakes for logs only.events_follow::stop_does_not_wait_for_the_next_poll: with a 30 s poll,stopreturns within 5 s.cargo test --workspace --no-fail-fast: 2183 passed, 0 failed, and all 184 test binaries ran.scripts/conformance-both.shoverevents,events_emit,metadata_eventsandpeek_wait, against the pinned Node build: Node passed 56 and failed 8, and this branch passed 64 and failed 0. The 8 are existing ledger entries.check-divergences.pyfinds none of them unrecorded, and no entry for these files stale.Callers with a stray argument. I found none.
8aad68af. It never spawnspty events, and its pty runtime has noeventscall.~/.local/binscripts and st work directories.scripts,bin,.claudeandskillsdirectories of every clone on the host, 675 directories in all.pty events --recent api, which is well formed.Release note.
pty eventsnow rejects an unknown argument instead of ignoring it and every option after it. Pass-t <sec>(not-t=60/--timeout=60) and--wait <type>. A wait or named follow now ends when its session's daemon dies without recording an exit.