srv, ibus: a note the daemon lives through keeps its endpoints
srvnote and addrnote unlinked on any note at all, and plan9port marks SIGPIPE Ignore: notify.c:59 lists it, and signotify runs the handler chain first and only then finds the Ignore flag and returns. So one broken pipe took the IPC socket and the IBus address file away from a daemon that went on running -- measured on a private runtime dir, a single kill -PIPE left the process in state Ssl with both files gone, so every client that focused a widget afterwards silently had no input method and only a restart brought it back. libxcb writes with writev, so the note is a broken X connection away; today xim.c's die() masks it by taking the daemon down on the same event, which is exactly why the two must not depend on each other. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -140,6 +140,38 @@ openpersistent(Test *t)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* plan9port ignores a broken pipe: the note handlers run and the daemon
|
||||
* goes on serving, so the endpoints it announced must still be there.
|
||||
*/
|
||||
static int
|
||||
survivenote(Test *t)
|
||||
{
|
||||
struct stat st;
|
||||
int fd, ok;
|
||||
|
||||
if(kill(t->firstpid, SIGPIPE) < 0)
|
||||
return fail("send a broken pipe to the first daemon: %s",
|
||||
strerror(errno));
|
||||
pausems(200);
|
||||
if(!daemonalive(&t->first))
|
||||
return fail("first daemon died of a broken pipe");
|
||||
if(lstat(t->l.socket, &st) < 0)
|
||||
return fail("IPC socket taken by a note the daemon survived: %s",
|
||||
strerror(errno));
|
||||
if(lstat(t->l.addrfile, &st) < 0)
|
||||
return fail("IBus address taken by a note the daemon survived: %s",
|
||||
strerror(errno));
|
||||
fd = connectsocket(t->l.socket, nowms() + Calltimeout);
|
||||
if(fd < 0)
|
||||
return fail("connect after a broken pipe: %s", strerror(errno));
|
||||
ok = ipcprobe(fd, "after a broken pipe");
|
||||
if(close(fd) < 0)
|
||||
return fail("close the client opened after a broken pipe: %s",
|
||||
strerror(errno));
|
||||
return ok;
|
||||
}
|
||||
|
||||
static int
|
||||
hardcrash(Test *t)
|
||||
{
|
||||
@@ -329,6 +361,8 @@ runrestart(Test *t, char *program, char *mapdir)
|
||||
if(!waitready(&t->l, &t->first, t->firstaddress, sizeof t->firstaddress) ||
|
||||
!privateaddress(t->firstaddress, t->firstpid) || !openpersistent(t))
|
||||
return 0;
|
||||
if(!survivenote(t))
|
||||
return 0;
|
||||
if(!hardcrash(t) || !waitipcclosed(t) || !waitbusclosed(t) ||
|
||||
!checkstale(t) || !rejectold(t, "after hard crash"))
|
||||
return 0;
|
||||
@@ -367,6 +401,6 @@ main(int argc, char **argv)
|
||||
showerrors(&test.second);
|
||||
return 1;
|
||||
}
|
||||
printf("daemon hard-crash endpoint recovery: ok\n");
|
||||
printf("daemon endpoints across a note and a hard crash: ok\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user