fix: downgrade trickle publisher 404 logs to DEBUG during teardown#3
Open
livepeer-tessa wants to merge 1 commit intomainfrom
Open
fix: downgrade trickle publisher 404 logs to DEBUG during teardown#3livepeer-tessa wants to merge 1 commit intomainfrom
livepeer-tessa wants to merge 1 commit intomainfrom
Conversation
When close() is called, set a _closing flag so that in-flight POST requests that receive a 404 from the orchestrator are logged at DEBUG level instead of ERROR. This avoids noisy false-alarm errors in session teardown sequences where the orchestrator closes trickle channels before the publisher has fully drained. A 404 during active session is still logged at ERROR (channel missing unexpectedly). Only 404s that arrive after close() has been initiated are treated as expected and suppressed to DEBUG. Fixes daydreamlive/scope#846 Signed-off-by: livepeer-tessa <livepeer-tessa@users.noreply.github.com>
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.
Problem
When a WebSocket client disconnects, the trickle publisher may still have in-flight POST requests that hit the orchestrator after it has already closed the trickle channels. These land as 404s and are currently logged at ERROR level, producing noisy false-alarm errors in Grafana Loki during what is actually a normal, graceful disconnect.
Reported in daydreamlive/scope#846.
Root Cause
_run_postalways logs 404s at ERROR regardless of whether the publisher is in the middle of shutting down.Fix
Add a
_closing: boolflag toTricklePublisherthat is set toTrueat the start ofclose(). In_run_post, 404 failures that occur while_closingis set are logged atDEBUGinstead ofERROR:ERROR(channel missing unexpectedly)DEBUG(expected, orchestrator already cleaned up)The terminal failure state is still recorded in both cases so the publisher correctly stops further POSTs.
Testing
Tested against the existing behavior description in the linked issue. No automated tests exist in this repo yet.