Skip to content

Issue 574 - Fix log_entries not reaching React UI#576

Open
webbpinner wants to merge 2 commits into
devfrom
issue_574
Open

Issue 574 - Fix log_entries not reaching React UI#576
webbpinner wants to merge 2 commits into
devfrom
issue_574

Conversation

@webbpinner

Copy link
Copy Markdown
Contributor

Summary

Fixes four root causes preventing log entries from appearing in the React UI on RHEL/AlmaLinux installations:

  • WebSocket frame size limit (web_backend/app/api/updates.py): The websockets library default 1 MB max_size was silently killing _cds_log_loop on its first connect. A backfill of 100 log records across many loggers easily exceeds this limit — the CDS closed the connection with 1009 message too big, first_connect was already False, so all retries used seconds=0 and never attempted the backfill again. Fixed by setting max_size=None on both websockets.connect() calls.
  • SELinux blocking CDS connections (utils/install_openrvdas.sh): On RHEL/AlmaLinux, httpd_can_network_connect was off by default and port 8766 (CDS) was unlabeled, preventing uWSGI/FastAPI from reaching the CachedDataServer. Extracted SELinux configuration into a dedicated setup_selinux() function that runs unconditionally on CentOS/RHEL, independent of the firewall setup choice.
  • _db_poll_loop missing exception guard (web_backend/app/api/updates.py): An unhandled DB exception in _db_poll_loop could propagate through asyncio.wait(FIRST_COMPLETED) and cancel the sibling _cds_log_loop task. Wrapped the DB query in a try/except.
  • wsBaseUrl() missing fallback (web_frontend/src/hooks/useLoggerStateWS.ts): When VITE_SERVER_API_BASE_URL is unset (the default for same-origin production builds), wsBaseUrl() returned an empty string, producing an invalid WebSocket URL. Now falls back to window.location.origin, mirroring the pattern already used in api.tsx.

Tests

  • Verified log entries appear in the React UI on an AlmaLinux 9 install after pulling and restarting the FastAPI service.

Related: #574

webbpinner and others added 2 commits June 22, 2026 08:58
Three related fixes for log entries missing from the React frontend on
RHEL/AlmaLinux installations:

1. utils/install_openrvdas.sh: Extract SELinux configuration into a
   dedicated setup_selinux() function that runs unconditionally on
   CentOS/RHEL, independent of firewall setup. Adds
   httpd_can_network_connect boolean and labels port 8766 (CDS) as
   http_port_t so uWSGI/FastAPI can reach the CachedDataServer.

2. web_backend: Guard _db_poll_loop() against transient DB exceptions so
   an unhandled error does not cancel the sibling _cds_log_loop task via
   asyncio.wait(FIRST_COMPLETED).

3. web_frontend: Fall back to window.location.origin in wsBaseUrl() when
   VITE_SERVER_API_BASE_URL is unset, preventing an invalid (empty-prefix)
   WebSocket URL in same-origin production deployments.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gitguardian

gitguardian Bot commented Jun 22, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
23771063 Triggered Generic Password b432e7e utils/install_openrvdas.sh View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@webbpinner webbpinner changed the title Issue 574 Issue 574 - Fix log_entries not reaching React UI Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants