← Back to Pull requests

SOLR-18336, SOLR-18665: Wait for Jetty's state file when starting Solr #5389

Open
unknown opened this pull request with 396 lines diff across 4 files
View on GitHub
unknown unknown commented on Nov 25, 2026 11:51 UTC
Author

https://issues.apache.org/jira/browse/SOLR-18336
https://issues.apache.org/jira/browse/SOLR-18665

Replaces the two draft PRs #4710 (SOLR-18336) and #5368 (SOLR-18665) with one script-only change.

  • bin/solr start and bin\solr.cmd start no longer call the node over HTTP to see that it has started. Background starts enable a new state Jetty module (the stock StateLifeCycleListener), and the scripts wait for STARTED in SOLR_PID_DIR/solr-<port>.state, next to the PID file.

  • Fixes SOLR-18336: the Windows wait covers only the node being started, not every node with a PID file.

  • Fixes SOLR-18665 follow-up: the wait no longer fails when the node is not reachable on localhost, such as with a TLS certificate issued for another host name.

  • A FAILED state, such as a port conflict, ends the wait at once instead of after SOLR_START_WAIT.

  • Both scripts print the same messages bin/solr has always printed. On failure solr.cmd now also shows the last 30 lines of solr.log, using PowerShell.

  • No Java changes apart from one deleted stale comment in StatusTool. The start wait no longer launches a second JVM.
  • How the Jetty state file works

    Jetty ships a StateLifeCycleListener that appends one line to a file for each lifecycle change of the server: STARTING, STARTED, FAILED, STOPPING, STOPPED. Jetty's own state module enables it so that jetty.sh can wait for startup; this PR adds the same module to Solr's server dir, since Solr ships its own module set.

    STARTED is written only after Server.doStart() has returned. That method first starts the handlers, which runs Solr's CoreContainerProvider and CoreContainer.load() to completion (ZooKeeper connect, live-node registration, _default configset upload), and then starts the connectors. So when the line appears, the node accepts and answers requests. A request sent earlier is not refused; it waits in the accept backlog. As before, replicas on a node in cloud mode may still be loading in the background.

    Notes for review

  • The scripts now pass -Dsolr.pid.dir to the node, and security.policy grants it that one file (${solr.pid.dir}/solr-${solr.port.listen}.state), not the directory: the default PID dir is the install's bin.

  • Jetty reports STARTED even if the CoreContainer failed to load, so start succeeds in that case, as it did before #5358.

  • The Windows success line has no (pid=N) yet; #5348 resolves the PID and conflicts with this PR in the same few lines of solr.cmd.
  • Tests: re-enables SslTest.useDifferentHostnameWhenNotCheckingPeerName and SslTest.useDifferentHostnameWithCurlResolve, and drops the _default configset wait in ZkTest. SecurityManagerTest.stateFileInSeparatePidDir starts a node with a PID dir outside the granted dirs, and fails if the node runs without a security manager on a JDK below 24. Full CATS suite passes on macOS; SslTest, ZkTest and BasicAuthTest pass on Windows.

    Diff: 396 lines (+297 / -99) across 4 files Reviewer: janhoy Review duration: 9465m
    All Vouch review confidence checks passed
    Residual risk 0.23 = Change Risk (0.43) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 396 lines diff across 4 files
    0.43
    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: 35%
    46%
    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
    Diff Size diff_size
    0.358
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #5389"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% 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: 43.2% (MEDIUM) · Higher = larger blast radius
    43.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: 46.7% · Lower = rushed or shallow review
    46.7%
    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: 23% · Safe to merge
    23%
    Repository