← Back to Pull requests

Keep file descriptors inherited by default #65

Open
belovdv opened this pull request with 191 lines diff across 7 files
View on GitHub
belovdv belovdv commented on Jan 20, 2024 17:14 UTC
Author

From #64:

Then jobserver is initialized from pipe, it sets cloexec, but doesn't delete environment variable which points to file descriptors. By default (unless Client::configure is used), child process will be instructed (if it uses jobserver) to access file descriptors that was closed and maybe reopened to point to other files.

This seems like a violation of IO-safety.

Either cloexec shouldn't be set or the environment variables should also be removed and only be added back via configure.

---

This pr is aimed to implement first option.

Concerns:

  • current behavior is how gnu make works,

  • it may be breaking change.
  • Reasons to choose first option:

  • in a typical case inheritance is what we want - inheritance by default will reduce amount of places in code where jobserver code is called,

  • fifo-style (named pipes) jobserver is inherited by default:

  • - it's weird to have different behaviors depending on implementation details,

  • - modern posix gnu make uses this fifo style by default, so it may be more common in the future,

  • second option requires changing (more) global things (cloexec, environment variable).
  • ---

    Concerns:

  • with inheritance by default, how to work with multiply jobservers at once, if it would be necessary?

  • with inheritance by default, Client::new in current pr's code changes global state - env var.
  • Notes:

  • pr is a draft, in particular, documentation wasn't updated,

  • windows implementation creates semaphore without SECURITY_ATTRIBUTES::bInheritHandle and does nothing in Client::configure. According to learn.microsoft.com, the handle cannot be inherited by child processes.
  • Diff: 191 lines (+63 / -128) across 7 files Reviewer: None requested Review duration: 1511157m
    All Vouch review confidence checks passed
    Residual risk 0.36 = Change Risk (0.62) × (1 − Review Confidence (0.42)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.62 · 191 lines diff across 7 files
    0.62
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 10%
    42%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.315
    No Reviewer Assigned no_reviewer_assigned
    0.120
    Real PR Conversation Timeline
    1 item
    "Review active on #65"
    general weight: 0.35
    Reviewers
    None requested
    Assignees
    belovdv belovdv
    Labels
    risk: medium confidence: 42.2% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 62.2% (MEDIUM) · Higher = larger blast radius
    62.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 42.2% · Lower = rushed or shallow review
    42.2%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 36.0% · Moderate risk
    36.0%