Skip to content

server: quiet health_live warn when upstream socket not ready - #26741

Merged
BeryJu merged 5 commits into
goauthentik:mainfrom
hippi345:fix/health-live-startup-enoent
Oct 29, 2026
Merged

BeryJu merged 5 commits into
goauthentik:mainfrom
hippi345:fix/health-live-startup-enoent

Conversation

@hippi345

@hippi345 hippi345 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Fixes #26686

During startup, /health/live/ can hit the upstream Unix socket before it exists. Connect failures with ErrorKind::NotFound (ENOENT) were logged at warn in both the client helpers and (via ? → AppError) the HTTP handler, producing false-positive production warnings from the in-process healthcheck.

Changes:

  • Add is_connect_not_found in src/server/mod.rs and src/worker/mod.rs to detect NotFound in the error source chain.
  • Downgrade that case to debug in server/worker health_live client helpers; keep warn for other failures.
  • In src/server/core.rs and src/worker/healthcheck.rs, handle Connect/NotFound without propagating through AppError (which always warns), returning SERVICE_UNAVAILABLE instead.

Health still reports not-live until the socket works; only the log level for the expected startup race changes.

AI disclosure

This change was written with assistance from Cursor's Claude Sonnet coding agent. I reviewed the diff, verified the NotFound classification and AppError bypass paths against the reported startup logs, and take responsibility for the submission per AI_POLICY.md.

Before the Unix socket exists, health_live (and the analogous path in
the worker) called the upstream via hyper_util's legacy Client.  A
connect failure with ENOENT (No such file or directory) was logged at
warn level, producing false-positive production warnings from the
in-process healthcheck during every normal startup.

Add a small helper  that walks the error's
source chain looking for an  with .
In  (server and worker), use it to downgrade that
specific case to ; all other connect/request failures continue
to log at  so real outages remain visible.

The fix still returns Err so the health endpoint correctly reports
not-live until the socket is up — it only adjusts the log level for
the expected startup race.

Signed-off-by: hippi345 <[email protected]>
When the upstream Unix socket does not yet exist, the health_live
handler in src/server/core.rs used to call server.health_live().await?
which converted the eyre::Report into AppError.  AppError::into_response
unconditionally logs warn!(err = ?self.0, "error occurred"), producing a
second spurious warning on top of the one already silenced in the client
layer.

Replace the await? with an explicit match.  A Connect/NotFound error
(socket not ready) is now logged at debug and the handler returns
SERVICE_UNAVAILABLE directly, bypassing AppError entirely.  All other
errors continue to log at warn and return SERVICE_UNAVAILABLE; no error
is silently swallowed.

Apply the same debug/warn split to the worker healthcheck handler
(src/worker/healthcheck.rs), which also logged warn unconditionally in
its Err arm.  Expose is_connect_not_found as pub(crate) in both
server/mod.rs and worker/mod.rs so the respective handler files can
import it.

Signed-off-by: hippi345 <[email protected]>
@netlify

netlify Bot commented Oct 6, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 1e96097
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6ac560267af17e0009863bfe
😎 Deploy Preview https://deploy-preview-26741--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@hippi345
hippi345 marked this pull request as ready for review October 6, 2026 21:03
@hippi345
hippi345 requested a review from a team as a code owner October 6, 2026 21:03
@BeryJu BeryJu changed the title fix(server): quiet health_live warn when upstream socket not ready server: quiet health_live warn when upstream socket not ready Oct 8, 2026
@codecov

codecov Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.43%. Comparing base (c4aed25) to head (cdbefbd).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/server/mod.rs 0.00% 15 Missing ⚠️
src/worker/mod.rs 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #26741      +/-   ##
==========================================
- Coverage   92.48%   92.43%   -0.06%     
==========================================
  Files        1197     1197              
  Lines       81195    81213      +18     
  Branches     4497     4515      +18     
==========================================
- Hits        75095    75069      -26     
- Misses       6034     6078      +44     
  Partials       66       66              
Flag Coverage Δ
conformance 31.13% <ø> (+<0.01%) ⬆️
e2e 35.99% <ø> (+<0.01%) ⬆️
integration 28.28% <ø> (-0.33%) ⬇️
rust 45.80% <0.00%> (-0.19%) ⬇️
unit 94.13% <ø> (+<0.01%) ⬆️
unit-migrate 94.13% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

Signed-off-by: Jens Langhammer <[email protected]>
@BeryJu
BeryJu merged commit 7d4eabf into goauthentik:main Oct 29, 2026
162 of 163 checks passed
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.

Server logs false-positive warn on /health/live/ during startup: client error (Connect) no such file or directory (os error 2)

3 participants