OLS-3799: Fix permanent Solr connection loss when RHOKP starts slowly - #3045
Conversation
|
@blublinsky: This pull request references OLS-3799 which is a valid jira issue. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
Warning Review limit reached
Next review available in: 3 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: raptorsun The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
concurrent request can burn out the retry count quickly, but it should rarely happen |
|
@blublinsky: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Description
Summary
When RHOKP takes longer than the retry window to start, the app-server permanently loses product documentation RAG with no recovery short of a pod restart. This PR fixes the root cause and simplifies the startup sequence.
Root Cause
solr_hybrid_search was a @cached_property — once it resolved to None (Solr unreachable), it stayed None forever
Index loading ran on a background thread, racing with request handling — a request could arrive before initialization completed
Changes
Removed background threading.Thread for index loading — load_index() now runs synchronously before start_uvicorn(). Eliminates race conditions between initialization and request handling. The readiness probe budget (8 min) accommodates the startup delay.
ols/utils/config.py
Changed solr_hybrid_search from @cached_property to @Property with manual caching. On failure, returns None without caching — the next request re-attempts initialization. After 3 failed attempts, gives up permanently with an error log. On success, caches the result for the lifetime of the process.
ols/src/rag_index/solr_support.py
Increased _SOLR_STARTUP_RETRIES from 24 to 36 (120s → 180s) to better align with RHOKP's startup probe budget (6 min).
tests/unit/query_helpers/test_docs_summarizer.py
Updated test to use the new caching attributes instead of dict manipulation.
Result
RHOKP starting after the app-server is tolerated without a pod restart
No race between background thread and request handling
Bounded retry: 3 attempts × 180s = 9 minutes max before permanent give-up with clear error log
Type of change
Related Tickets & Documents
https://redhat.atlassian.net/browse/OLS-3799
https://redhat.atlassian.net/browse/OLS-3799
Checklist before requesting a review
Testing