mirror of
https://github.com/NixOS/nix
synced 2025-06-25 14:51:16 +02:00
MonitorFdHup
: Don't sleep anymore
After the previous commit it should not be necessary. Furthermore, if we *do* sleep, we'll exacerbate a race condition (in conjunction with getting rid of the thread cancellation) that will cause test failures.
This commit is contained in:
parent
9b3352c3c8
commit
49f486d8e0
1 changed files with 18 additions and 5 deletions
|
@ -98,11 +98,24 @@ public:
|
||||||
if (fds[1].revents & POLLHUP) {
|
if (fds[1].revents & POLLHUP) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// On macOS, it is possible (although not observed on macOS
|
// On macOS, (jade thinks that) it is possible (although not
|
||||||
// 14.5) that in some limited cases on buggy kernel versions,
|
// observed on macOS 14.5) that in some limited cases on buggy
|
||||||
// all the non-POLLHUP events for the socket get delivered.
|
// kernel versions, all the non-POLLHUP events for the socket
|
||||||
// Sleeping avoids pointlessly spinning a thread on those.
|
// get delivered.
|
||||||
sleep(1);
|
//
|
||||||
|
// We could sleep to avoid pointlessly spinning a thread on
|
||||||
|
// those, but this opens up a different problem, which is that
|
||||||
|
// if do sleep, it will be longer before the daemon fork for a
|
||||||
|
// client exits. Imagine a sequential shell script, running Nix
|
||||||
|
// commands, each of which talk to the daemon. If the previous
|
||||||
|
// command registered a temp root, exits, and then the next
|
||||||
|
// command issues a delete request before the temp root is
|
||||||
|
// cleaned up, that delete request might fail.
|
||||||
|
//
|
||||||
|
// Not sleeping doesn't actually fix the race condition --- we
|
||||||
|
// would need to block on the old connections' tempt roots being
|
||||||
|
// cleaned up in in the new connection --- but it does make it
|
||||||
|
// much less likely.
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue