-
Notifications
You must be signed in to change notification settings - Fork 17
Port build hook timeout commits from upstream #583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,7 @@ | |
| #include <map> | ||
| #include <sstream> | ||
| #include <optional> | ||
| #include <thread> | ||
|
|
||
| namespace nix { | ||
|
|
||
|
|
@@ -35,6 +36,8 @@ class Pid | |
| pid_t pid = -1; | ||
| bool separatePG = false; | ||
| int killSignal = SIGKILL; | ||
| std::chrono::milliseconds killTimeout; | ||
| std::thread killThread; | ||
|
Comment on lines
+39
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Preserve timeout state when moving
Initialize 🤖 Prompt for AI Agents
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is probably worth fixing even if it doesn't affect this PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
processes_cc="$(fd -a '^processes\.cc$' src/libutil | head -n1)"
if [ -z "$processes_cc" ]; then
echo "src/libutil unix processes implementation was not found." >&2
exit 1
fi
ast-grep outline "$processes_cc" --items all --match 'Pid|kill|wait|setKillTimeout' --view expanded
rg -n -C 12 --glob 'processes.cc' \
'Pid::Pid\(Pid &&|Pid::operator=\(Pid &&|void Pid::setKillTimeout|int Pid::kill|int Pid::wait|killThread|killTimeout' \
src/libutil
ast-grep outline src/libutil/include/nix/util/processes.hh --match 'Pid' --view expandedLength of output: 12393 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- Pid destructor and adjacent lifecycle code ---'
sed -n '35,175p' src/libutil/unix/processes.cc
printf '%s\n' '--- Direct Pid moves and move assignments ---'
rg -n -C 5 --glob '*.{cc,hh}' \
'(?:std::move\([^)]*\)|return)\s*.*\bPid\b|\bPid\s+\w+\s*=\s*std::move|\boperator=\(std::move' \
srcLength of output: 4244
The minimal safe fix is:
Do not move or swap You are interacting with an AI system. |
||
| #else | ||
| AutoCloseFD pid = INVALID_DESCRIPTOR; | ||
| #endif | ||
|
|
@@ -60,6 +63,7 @@ public: | |
| #ifndef _WIN32 | ||
| void setSeparatePG(bool separatePG); | ||
| void setKillSignal(int signal); | ||
| void setKillTimeout(std::chrono::milliseconds duration); | ||
| pid_t release(); | ||
| #endif | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Reject a zero build-hook kill timeout.
This setting accepts
0.Pid::kill()then skips the SIGKILL timeout worker, so a hook that ignores SIGTERM can block shutdown indefinitely. This conflicts with the documented SIGKILL behavior.Reject zero during setting validation, or explicitly document that zero disables forced termination.
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lisanna-dettwyler This seems like a relevant comment. The ability to disable the timeout seems useful, but it should be documented.