feat(init): watchdog: pinger thread PINGs servers (framework answers, no server code), main kills after 5s unanswered -> crash path; not pinged: terminal, pm (handlers wait for user); give-up drains queued ping; spawntest hang check

This commit is contained in:
2026-10-28 01:51:39 +01:00
parent 28f1ace00a
commit 3d69c10079
9 changed files with 236 additions and 18 deletions

View File

@@ -58,6 +58,9 @@ pub struct Program {
/// Its clients keep state in it (a subscription, focus, a handle), so
/// they are restarted after it is.
pub restarts_clients: bool,
/// Pinged by the watchdog (see init's watchdog.rs): not if a handler of
/// its waits for the user, which a ping cannot tell from a hang.
pub pinged: bool,
}
/// Enough for a small program: its image, stack and a little heap.
@@ -85,6 +88,7 @@ const fn server(name: &'static str, file: &'static [u8], limits: Limits) -> Prog
takes_ctrl_c: false,
restart: true,
restarts_clients: false,
pinged: true,
}
}
@@ -103,8 +107,8 @@ pub const SERVERS: &[Program] = &[
..server("display", b"bin/display", Limits { pages: 1280, regions: 4, ..SMALL })
},
// Text on the display, lines from the keyboard (it takes input focus).
// Its clients wait on lines and Ctrl+C.
Program { uses: &["display"], restarts_clients: true, ..server("terminal", b"bin/terminal", SMALL) },
// Its clients wait on lines and Ctrl+C; `READ` waits for the user.
Program { uses: &["display"], restarts_clients: true, pinged: false, ..server("terminal", b"bin/terminal", SMALL) },
server("session", b"bin/session", SMALL),
];
@@ -133,6 +137,8 @@ pub const SESSION: &[Program] = &[Program {
spawns: Some(Limits { pages: 512, endpoints: 8, notifications: 8, regions: 8 }),
// The shell holds handles to the apps it ran, which die with it.
restarts_clients: true,
// Installing waits for the user's consent.
pinged: false,
..server("permission", b"bin/permission", Limits { pages: 96, ..SMALL })
}];