Open flokli opened 1 year ago
Triaged in the Nix team meeting:
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/2023-04-28-nix-team-meeting-minutes-50/27698/1
I've seen bulky output get truncated, which would be the opposite problem of this issue.
The process exit and pipe close are independent and important events. I think a good algorithm would be:
// pseudocode; haven't written much std::variant or concurrent code yet; apologies
struct LogCompleted { };
runBuilderProcess() {
auto builderPid = forkBuilderChild();
future<ExitCode> exitCode = forkThread(() -> waitpid(builderPid));
future<LogCompleted> outputDone = forkThread(logShovelingThread);
std::variant<ExitCode, LogCompleted> firstResult = awaitFirstOf(exitCode, outputDone);
firstResult.visit {
exitCode -> {
try {
outputDone.awaitWithTimeout(10s)
}
catch {
throw/return/warn/whatever "Console wasn't closed within 10s after builder exited with status %i. Did some child process keep the output open?";
}
},
logCompleted -> {
try {
exitCode.awaitWithTimeout(10s)
}
catch {
warn/whatever "builder has not exited within 10s after closing its log output.";
exitCode.await();
}
}
};
handle exitCode;
}
Triaged in Nix maintainers team meeting 2023-06-09 without conclusion.
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/2023-06-09-nix-team-meeting-minutes-61/29163/1
Describe the bug
I have some Nix build forking off a long-running process in the background. In that specific example, a postgresql database.
The build process starts the database, does some insertions and queries in it, then renders a document into
$out
(end of build script).On Linux, after all steps in the build script have been finished, the build exits, and the output can be observed.
On Darwin, the build process gets stuck indefinitely.
A workaround is to manually register cleanup traps in bash.
Steps To Reproduce
Build the following on
x86_64-linux
vsaarch64-darwin
:Expected behavior
I'd expect in both cases the build to end, and the sleep process to be killed at the end of the build script.
nix-env --version
outputPriorities
Add :+1: to issues you find important.