Repository navigation
A session whose owner hung up is not handed again, and an open asks again for one that ended - #1206
Conversation
…gain for one that ended The compositor asks for a desktop session the moment its control connection ends. The supervisor answered the screen's row with its open desktop session unless that session's owner had exited, by a non-blocking wait. The kernel closes an ending process's handles before it publishes its exit, and publishes the exit only after every end below it, so an ask in between was handed the ended session: its control port answered `Gone`, the compositor said `no desktop session: ... Gone; the next launch asks again`, and opened none until something launched. Two changes, at the two ends of the answer: - The supervisor reads the owner's hang-up of its link, which that same close of handles makes, and keeps it (`Link::HungUp`): a session whose owner hung up is not handed again, and the loop stops watching a link that is readable for good. The decision takes both signs of an owner's end (`sessions::Open`), and its host test holds a hung-up owner whose exit is not published. - `toyos_session::open` asks again when the session it was handed has no controls left. However current the supervisor's reading, an owner can end after it answers; `Gone` says so, and the next ask finds the end read or a new session. Seen in guest-rows run 42089538985, where `session_lifecycle` stalled at "the desktop to open again". Closes issues/a-desktop-reopened-as-its-session-ends-is-handed-the-ended-session.md. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A link is now either not yet connected or hung up, and the line said only the first. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Review r1 of #1206 at
|
| Gap | Close before landing? |
|---|---|
Guest control exercises the re-ask, not Link::HungUp |
No. The predicate is host-tested with a control, and the wiring is two lines I read (system/supervisor/src/sessions.rs:431-434, :360-365). The suggestion above closes it if wanted. |
| Kernel-spin control inconclusive | No. The cause stands without it. The explanation stays a guess; the scheduler pulls on idle (kernel/src/sched/driver.rs:470), so "the askers could not run" is not self-evident. |
| Head not guest-tested | No. c6f8f6667..9a234ec06 is one log string with no reader, and host CI compiled the head. The fix for blocker 1 does need the row again. |
Other consumers of the same window
None stalls; nothing to record.
- Compositor start (
system/compositor/src/signout.rs:77-93): aGonethere falls through to an ask, which now re-asks. - A launch into a dying session: waits on the launcher port the supervisor holds and reads its end at publication.
- A detached spawn under a dying owner: refused
Goneby the kernel. logout: lists a hung-up session as active until its exit is read, and a sign-out of it is refused "holds no link".
For the description
- The re-ask applies to every login authority. For a remote row,
Gonemeans a fresh owner failed, so one failed login now retries in a burst until the budget (3 failures in 10 s) or the room refuses it. Say so. - "So the asking ends" needs the same correction as the doc comment.
- Verified as stated: the three guest logs and their revisions, the two host test logs, the macOS red being the recorded llvm test, and that nothing outside
issues/cited the closed record.
SEND BACK
…e guest lockfile names the dependency `toyos_session::open` asked again for as long as the supervisor handed over a session whose controls were gone: with neither sign of the owner's end read it would have asked for good, silently, holding its caller's thread. It now asks for at most `ENDED_UNREAD`, 5 s, with no delay between asks, and then returns an error naming the state and the number of asks. Its doc comment says what ends the asking. `tests/guest/rust-tests/Cargo.lock` lists `toyos-abi` under `toyos-session`, as the manifest has since the fix. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Review r2 of #1206 at
|
| claim | what I found |
|---|---|
| head green | run 42941811828, head 9b3e6e286, PASS session_lifecycle |
| expiry control red | run 42941817419 at dfb8c1aa9; the compositor's line arrives 5.000 s after the session's end, then the row stalls on the owner that never exits |
| both spin arms green | runs 42944210533 at e47bb21c3 and 42945003574 at d85c16217 |
| the control patches | each published patch equals git diff 9b3e6e286 <control> |
| host log | 1 of 110 red, the build system: cargo test --lib: llvm::tests::the_caller_s_environment_reaches_neither_the_build_nor_the_key, the recorded macOS failure. The other FAILED lines are kernel-loom's negative controls. toyos-session's tests and the decision's test pass in it. |
The host log names no revision. It starts 52 s after the head's commit time, which fits.
SUGGESTION
lib/session/src/lib.rs:14— "No clock ends anything." now sits in a module with a clock. It means a sign-out; say "No clock ends a sign-out".lib/session/src/lib.rs:291,305— the clock starts before the first ask, butENDED_UNREADis documented as how longopengoes on asking for a session whose controls are gone. If the supervisor is slow to answer the first ask, oneGoneends the open with "1 times in 5 s" and no second ask. Starting the clock at the firstGonemakes the code match its comment.- To hold
Link::HungUpin a guest, use an owner-side control, since the kernel spin cannot. The owner drops its controls and its link 300 ms before it exits, with the re-ask removed: green needs the hang-up read. Add the decision ignoring the hang-up: red. Two dispatches, not needed to land.
LAND
Problem
session_lifecyclestalled once at "the desktop to open again"(
issues/a-desktop-reopened-as-its-session-ends-is-handed-the-ended-session.md).The compositor asks for a desktop session the moment its control connection
ends. The supervisor answered the screen's row with its open desktop session
unless that session's owner had exited, by a non-blocking wait. The kernel
closes an ending process's handles before it publishes its exit
(
teardown_resourcesbeforepublish_climb), and publishes only after everyend below it. An ask in between was handed the ended session: its control
port answered
Gone, the compositor saidno desktop session: … Gone; the next launch asks again, and opened none until something launched.Resulting behavior
keeps the hang-up of the owner's link, which the same close of handles
makes (
Link::HungUp). The loop also stops watching a link that would bereadable for good.
5 s.
toyos_session::openasks the supervisor again when the session itwas handed has no controls left. The supervisor's reading can be outrun by
an owner ending after it answers, more than once;
Gonesays so.supervisor's refusal, or after
ENDED_UNREAD(5 s) as an error that namesthe state and the number of asks.
a remote row
Gonemeans a fresh owner failed, so one failed login nowretries in a burst until the budget (3 failures in 10 s) or the room
refuses it.
Decisions
design, so handles close first.
counted to the compositor's job.
sessions::Open'shung_upandexited).toyos-sessionnow namestoyos-abiforSyscallError::Gone.Checks
session_lifecycleon the guest runner (QEMU x86-64). Round 2, at the head9b3e6e286; every control is a patch on that head.9b3e6e286dfb8c1aa9the supervisor handed over a session whose controls are gone 145833 times in 5 se47bb21c3d85c16217cargo run -- --ci host, macOS9b3e6e286issues/the-llvm-environment-test-breaks-git-on-macos.mdBoth kernel-spin controls are green, so the question the review asked
stays open. With the re-ask removed, the spin leaves the row green whether
or not the decision reads the hang-up. The spin therefore does not reproduce
the stall, and its first arm shows nothing about
Link::HungUp. Why thespin does not reproduce is not established.
Link::HungUpis still held ina guest by nothing: the host test with its control holds the decision, and
the wiring is the two sites the review read.
Round 1, at
c6f8f6667, still stands for what it showed:aaa0bc08bno desktop session: … Gone, then the stall68cabe5b49a234ec069a234ec06Some(0)forNoneEvidence: r2 https://github.com/ToyOSOrg/evidence/tree/09d8692598f285c4e0cfa894e55f9a7be723929e/r2, r1 https://github.com/ToyOSOrg/evidence/tree/09d8692598f285c4e0cfa894e55f9a7be723929e/r1
Review r1
says what ends the asking. The expiry control above shows the message.
tests/guest/rust-tests/Cargo.lockliststoyos-abiundertoyos-session.Records
Closes
issues/a-desktop-reopened-as-its-session-ends-is-handed-the-ended-session.md.Nothing outside
issues/cited it.Risks
openasks in a loop ofsupervisor round trips with no delay between them: about 29 000 a second
in the expiry control, for 5 s at most.
docs/does not describe how a desktop session isreopened.
🤖 Generated with Claude Code