Degrade gracefully when flock is unavailable on NFS-backed log volumes#1561
Open
zakame wants to merge 2 commits into
Open
Degrade gracefully when flock is unavailable on NFS-backed log volumes#1561zakame wants to merge 2 commits into
zakame wants to merge 2 commits into
Conversation
Add _try_flock() to catch EBADF/ENOLCK on first failure, set a sticky flock_disabled flag, and fall back to best-effort unlocked logging. Also add LRR_LOG_LOCK_DIRECTORY env var and autoflush on all log handles.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1556
Since #1406,
RotatingLogdies on everyappend()when the log volume is NFS without a working lock manager (EBADF/ENOLCKfromflock(2)), crashing Mojolicious workers on every log write.Changes:
_try_flock(): wraps allflock()calls; on firstEBADF/ENOLCK, sets a stickyflock_disabledflag, emits onewarn()with remediation hints, and falls back to best-effort unlocked logging for that processLRR_LOG_LOCK_DIRECTORY: env var to relocate the.lockfile to a local path when the log volume is NFSautoflush(1)on all handle-creation paths to avoid losing log lines on SIGKILL/OOMKillTests in
tests/LANraragi/Utils/RotatingLog.t.This is the alternative approach to #1559 — detection at the point of first
flock()failure rather than a startup probe, which also handles the case where flock degrades mid-process. Happy to consolidate if you prefer one approach.