Skip to content

fix: downgrade trickle publisher 404 logs to DEBUG during teardown#3

Open
livepeer-tessa wants to merge 1 commit intomainfrom
fix/trickle-publisher-404-teardown-noise
Open

fix: downgrade trickle publisher 404 logs to DEBUG during teardown#3
livepeer-tessa wants to merge 1 commit intomainfrom
fix/trickle-publisher-404-teardown-noise

Conversation

@livepeer-tessa
Copy link
Copy Markdown

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_post always logs 404s at ERROR regardless of whether the publisher is in the middle of shutting down.

Fix

Add a _closing: bool flag to TricklePublisher that is set to True at the start of close(). In _run_post, 404 failures that occur while _closing is set are logged at DEBUG instead of ERROR:

  • Active session + 404 → still ERROR (channel missing unexpectedly)
  • Teardown (post-close) + 404DEBUG (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.

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>
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.

1 participant